cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ronny Schleicher (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-9724) StatusBar in iOS: Size of the status bar is calculated incorrectly after a orientation change
Date Wed, 30 Sep 2015 10:45:04 GMT

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

Ronny Schleicher updated CB-9724:
---------------------------------
    Description: 
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.
---------------------------- My Workaround ---------------------------
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.

{{
(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;
}
}}

{quote}
- (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;
    }
}
{quote}

  was:
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.
---------------------------- My Workaround ---------------------------
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.

{{monospaced}}
(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;
}
{{monospaced}}

{quote}
- (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;
    }
}
{quote}


> 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 with iOS version 8 or 9.
>            Reporter: Ronny Schleicher
>
> 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.
> ---------------------------- My Workaround ---------------------------
> 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.
> {{
> (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;
> }
> }}
> {quote}
> - (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;
>     }
> }
> {quote}



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


Mime
View raw message