You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "jcesarmobile (JIRA)" <ji...@apache.org> on 2015/10/20 16:39:28 UTC

[jira] [Reopened] (CB-9724) StatusBar in iOS: Size of the status bar is calculated incorrectly after a orientation change

     [ https://issues.apache.org/jira/browse/CB-9724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jcesarmobile reopened CB-9724:
------------------------------

I'm reopening this issue because I've been able to reproduce the issue, (or a similar one) but following this steps:

1. Add <preference name="StatusBarOverlaysWebView" value="false" />
2. Start app -> The status bar appears with normal size
3. Rotate device -> The status bar will change the size.

It's more noticeable if you start the app in landscape and rotate to portrait, the bar will be twice the size.
If you start in portrait and change to landscape, the bar will be a bit smaller

If I hide and show as the original STR the problem doesn't appear

> StatusBar in iOS: Size of the status bar is calculated incorrectly after a orientation change
> ---------------------------------------------------------------------------------------------
>
>                 Key: CB-9724
>                 URL: https://issues.apache.org/jira/browse/CB-9724
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: 3.5.0, 4.1.0
>         Environment: iPhone or iPad with iOS version 8 and 9.
>            Reporter: Ronny Schleicher
>            Assignee: jcesarmobile
>
> h3. Steps to reproduce:
> 1. Create a PhoneGap App and use the Statusbar-Plugin to show the Statusbar.
> 2. Start your App in Portrait. 
> 4. Now remove the statusbar in the runtime of your app (with a button click or somethink else) with 'StatusBar.hide();'
> 5. Now turn the iPhone 90 degrees in landscape mode.
> 6. After this enable the StatusBar  in the runtime of your app (with a button click or somethink else) with 'StatusBar.show();'
> 7. Error -> the StatusBar size in incorrect.
> h3. My Workaround / Bugfix
> Add in the file '.\Plugins\cordova-plugin-statusbar\CDVStatusBar.m' in follow two function a && !IsAtLeastiOSVersion(@"8.0"). In my m-file is it in  line 204 and 373.
> {code:title=CDVStatusBar.m|borderStyle=solid}
> - (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView
> {
>     // we only care about the latest iOS version or a change in setting
>     if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) {
>         return;
>     }
>     CGRect bounds = [[UIScreen mainScreen] bounds];
>     if (statusBarOverlaysWebView) {
>         [_statusBarBackgroundView removeFromSuperview];
>         if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation) *&& !IsAtLeastiOSVersion(@"8.0")*) {
>             self.webView.frame = CGRectMake(0, 0, bounds.size.height, bounds.size.width);
>         } else {
>             self.webView.frame = bounds;
>         }
>     } else {
>         CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
>         statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
>         [self initializeStatusBarBackgroundView];
>         CGRect frame = self.webView.frame;
>         frame.origin.y = statusBarFrame.size.height;
>         frame.size.height -= statusBarFrame.size.height;
>         self.webView.frame = frame;
>         [self.webView.superview addSubview:_statusBarBackgroundView];
>     }
>     _statusBarOverlaysWebView = statusBarOverlaysWebView;
> }
> - (void) hide:(CDVInvokedUrlCommand*)command
> {
>     UIApplication* app = [UIApplication sharedApplication];
>     if (!app.isStatusBarHidden)
>     {
>         self.viewController.wantsFullScreenLayout = YES;
>         CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
>         [self hideStatusBar];
>         if (IsAtLeastiOSVersion(@"7.0")) {
>             [_statusBarBackgroundView removeFromSuperview];
>         }
>         if (!_statusBarOverlaysWebView) {
>             CGRect frame = self.webView.frame;
>             frame.origin.y = 0;
>             if (!self.statusBarOverlaysWebView) {
>                 if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation) && !IsAtLeastiOSVersion(@"8.0")) {
>                     frame.size.height += statusBarFrame.size.width;
>                 } else {
>                     frame.size.height += statusBarFrame.size.height;
>                 }
>             }
>             self.webView.frame = frame;
>         }
>         _statusBarBackgroundView.hidden = YES;
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org