mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-31 10:35:41 +08:00
CB-13394 (iOS): fix iPhone X StatusBar rendering in landscape
This closes #89 and closes #88
This commit is contained in:
parent
049ac41dad
commit
cdc9295b30
@ -100,6 +100,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
//add a small delay for iOS 7 ( 0.1 seconds )
|
//add a small delay for iOS 7 ( 0.1 seconds )
|
||||||
__weak CDVStatusBar* weakSelf = self;
|
__weak CDVStatusBar* weakSelf = self;
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
|
[self resizeStatusBarBackgroundView];
|
||||||
[weakSelf resizeWebView];
|
[weakSelf resizeWebView];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -431,11 +432,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
// there is a possibility that when the statusbar was hidden, it was in a different orientation
|
// there is a possibility that when the statusbar was hidden, it was in a different orientation
|
||||||
// from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
|
// from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
|
||||||
// statusBar's current size
|
// statusBar's current size
|
||||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
[self resizeStatusBarBackgroundView];
|
||||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
|
||||||
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
|
||||||
sbBgFrame.size = statusBarFrame.size;
|
|
||||||
_statusBarBackgroundView.frame = sbBgFrame;
|
|
||||||
[self.webView.superview addSubview:_statusBarBackgroundView];
|
[self.webView.superview addSubview:_statusBarBackgroundView];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -446,6 +443,14 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)resizeStatusBarBackgroundView {
|
||||||
|
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||||
|
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||||
|
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
||||||
|
sbBgFrame.size = statusBarFrame.size;
|
||||||
|
_statusBarBackgroundView.frame = sbBgFrame;
|
||||||
|
}
|
||||||
|
|
||||||
-(void)resizeWebView
|
-(void)resizeWebView
|
||||||
{
|
{
|
||||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||||
@ -468,10 +473,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
CGFloat height = statusBarFrame.size.height;
|
CGFloat height = statusBarFrame.size.height;
|
||||||
|
|
||||||
if (!self.statusBarOverlaysWebView) {
|
if (!self.statusBarOverlaysWebView) {
|
||||||
if (_statusBarVisible) {
|
frame.origin.y = height;
|
||||||
// CB-10158 If a full screen video is playing the status bar height will be 0, set it to 20 if _statusBarVisible
|
|
||||||
frame.origin.y = height > 0 ? height: 20;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (isIOS11) {
|
if (isIOS11) {
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
|
||||||
|
Loading…
Reference in New Issue
Block a user