iOS: hasNotch implements
This commit is contained in:
parent
b626eb3071
commit
ef0e53a7ac
@ -68,6 +68,7 @@ - (instancetype)init {
|
||||
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
||||
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
||||
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
||||
@"hasNotch": @(hasNotch()),
|
||||
@"deviceBrand": @"Apple",
|
||||
@"deviceModel": platform,
|
||||
};
|
||||
|
@ -42,3 +42,5 @@ NSBundle *_Nonnull DoricBundle(void);
|
||||
void ShowToast(NSString *_Nonnull text, DoricGravity gravity);
|
||||
|
||||
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
||||
|
||||
BOOL hasNotch(void);
|
||||
|
@ -95,3 +95,12 @@ void ShowToast(NSString *text, DoricGravity gravity) {
|
||||
UIGraphicsEndImageContext();
|
||||
return image;
|
||||
}
|
||||
|
||||
BOOL hasNotch() {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
CGFloat height = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;
|
||||
return (height > 0);
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user