From 7ca35522242c1fa73b4e3e7b33b804c121e14194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20C=C3=A9sar?= Date: Sun, 6 Mar 2016 11:55:49 +0100 Subject: [PATCH] Fix for CB-10752 status bar overlays the webview on iOS 6 in some cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don’t allow the statusbar to overlay the webview on iOS 6, but in some cases it happens. This changes avoid it. --- src/ios/CDVStatusBar.m | 51 ++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m index bab37a2..dcfb88f 100644 --- a/src/ios/CDVStatusBar.m +++ b/src/ios/CDVStatusBar.m @@ -411,11 +411,10 @@ static const void *kStatusBarStyle = &kStatusBarStyle; BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0")); [self showStatusBar]; + [self resizeWebView]; if (isIOS7) { - [self resizeWebView]; - if (!self.statusBarOverlaysWebView) { // there is a possibility that when the statusbar was hidden, it was in a different orientation @@ -430,39 +429,37 @@ static const void *kStatusBarStyle = &kStatusBarStyle; } - } else { - - CGRect bounds = [[UIScreen mainScreen] applicationFrame]; - self.viewController.view.frame = bounds; } _statusBarBackgroundView.hidden = NO; } } --(void)resizeWebView { - - CGRect bounds = [[UIScreen mainScreen] bounds]; - - bounds = [self invertFrameIfNeeded:bounds]; - - if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) { +-(void)resizeWebView +{ + BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0")); + + if (isIOS7) { + CGRect bounds = [[UIScreen mainScreen] bounds]; + bounds = [self invertFrameIfNeeded:bounds]; + + if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) { + self.viewController.view.frame = bounds; + } + self.webView.frame = bounds; + + if (!self.statusBarOverlaysWebView) { + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + statusBarFrame = [self invertFrameIfNeeded:statusBarFrame]; + CGRect frame = self.webView.frame; + frame.origin.y = statusBarFrame.size.height; + frame.size.height -= statusBarFrame.size.height; + self.webView.frame = frame; + } + } else { + CGRect bounds = [[UIScreen mainScreen] applicationFrame]; self.viewController.view.frame = bounds; } - - self.webView.frame = bounds; - - if (!self.statusBarOverlaysWebView) { - - CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; - statusBarFrame = [self invertFrameIfNeeded:statusBarFrame]; - - CGRect frame = self.webView.frame; - frame.origin.y = statusBarFrame.size.height; - frame.size.height -= statusBarFrame.size.height; - self.webView.frame = frame; - } - } - (void) dealloc