mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-31 10:35:41 +08:00
CB-13311: (iOS) Statusbar does not overlay correctly on iPhone X
This closes #87
This commit is contained in:
parent
ef5fb5b9e6
commit
fff289c0b8
@ -449,6 +449,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
-(void)resizeWebView
|
-(void)resizeWebView
|
||||||
{
|
{
|
||||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||||
|
BOOL isIOS11 = (IsAtLeastiOSVersion(@"11.0"));
|
||||||
|
|
||||||
if (isIOS7) {
|
if (isIOS7) {
|
||||||
CGRect bounds = [self.viewController.view.window bounds];
|
CGRect bounds = [self.viewController.view.window bounds];
|
||||||
@ -472,8 +473,22 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
frame.origin.y = height > 0 ? height: 20;
|
frame.origin.y = height > 0 ? height: 20;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
|
if (isIOS11) {
|
||||||
frame.origin.y = height >= 20 ? height - 20 : 0;
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
|
||||||
|
if (@available(iOS 11.0, *)) {
|
||||||
|
float safeAreaTop = self.webView.safeAreaInsets.top;
|
||||||
|
if (height >= safeAreaTop && safeAreaTop >0) {
|
||||||
|
// Sometimes when in-call/recording/hotspot larger status bar is present, the safeAreaTop is 40 but we want frame.origin.y to be 20
|
||||||
|
frame.origin.y = safeAreaTop == 40 ? 20 : height - safeAreaTop;
|
||||||
|
} else {
|
||||||
|
frame.origin.y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
// Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
|
||||||
|
frame.origin.y = height >= 20 ? height - 20 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
frame.size.height -= frame.origin.y;
|
frame.size.height -= frame.origin.y;
|
||||||
self.webView.frame = frame;
|
self.webView.frame = frame;
|
||||||
|
Loading…
Reference in New Issue
Block a user