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