Repository: cordova-plugin-inappbrowser Updated Branches: refs/heads/master b51a4dc54 -> 80c8e56fb
CB-10305 Gray bar appears in the wrong place on iOS This closes #137 Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/80c8e56f Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/80c8e56f Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/80c8e56f Branch: refs/heads/master Commit: 80c8e56fb08979582a1dd31788607f35be635a48 Parents: b51a4dc Author: Julio César <[email protected]> Authored: Sat Jan 16 11:45:17 2016 +0100 Committer: sgrebnov <[email protected]> Committed: Thu Feb 4 18:32:52 2016 +0300 ---------------------------------------------------------------------- src/ios/CDVInAppBrowser.m | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/80c8e56f/src/ios/CDVInAppBrowser.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index b7820f3..8b2c90c 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -755,6 +755,10 @@ return UIStatusBarStyleDefault; } +- (BOOL)prefersStatusBarHidden { + return NO; +} + - (void)close { [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; @@ -1000,13 +1004,26 @@ // simplified from: http://stackoverflow.com/a/25669695/219684 - UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:frame]; + UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:[self invertFrameIfNeeded:frame]]; bgToolbar.barStyle = UIBarStyleDefault; + [bgToolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; [self.view addSubview:bgToolbar]; [super viewDidLoad]; } +- (CGRect) invertFrameIfNeeded:(CGRect)rect { + // We need to invert since on iOS 7 frames are always in Portrait context + if (!IsAtLeastiOSVersion(@"8.0")) { + if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { + CGFloat temp = rect.size.width; + rect.size.width = rect.size.height; + rect.size.height = temp; + rect.origin = CGPointZero; + } + } + return rect; +} #pragma mark CDVScreenOrientationDelegate --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
