CB-10305 Gray bar appears in the wrong place on iOS

This closes #137
This commit is contained in:
Julio César 2016-01-16 11:45:17 +01:00 committed by sgrebnov
parent b51a4dc54e
commit 80c8e56fb0

View File

@ -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