iOS: hasNotch implements
This commit is contained in:
parent
b626eb3071
commit
ef0e53a7ac
@ -68,6 +68,7 @@ - (instancetype)init {
|
|||||||
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
||||||
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
||||||
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
||||||
|
@"hasNotch": @(hasNotch()),
|
||||||
@"deviceBrand": @"Apple",
|
@"deviceBrand": @"Apple",
|
||||||
@"deviceModel": platform,
|
@"deviceModel": platform,
|
||||||
};
|
};
|
||||||
|
@ -42,3 +42,5 @@ NSBundle *_Nonnull DoricBundle(void);
|
|||||||
void ShowToast(NSString *_Nonnull text, DoricGravity gravity);
|
void ShowToast(NSString *_Nonnull text, DoricGravity gravity);
|
||||||
|
|
||||||
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color);
|
||||||
|
|
||||||
|
BOOL hasNotch(void);
|
||||||
|
@ -95,3 +95,12 @@ void ShowToast(NSString *text, DoricGravity gravity) {
|
|||||||
UIGraphicsEndImageContext();
|
UIGraphicsEndImageContext();
|
||||||
return image;
|
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