cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcesarmobile (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-10305) Gray bar appears in the wrong place
Date Fri, 15 Jan 2016 11:30:39 GMT

    [ https://issues.apache.org/jira/browse/CB-10305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15101665#comment-15101665
] 

jcesarmobile edited comment on CB-10305 at 1/15/16 11:30 AM:
-------------------------------------------------------------

This should fix all the issues:

{code}
@implementation CDVInAppBrowserNavigationController : UINavigationController

- (void) viewDidLoad {

    CGRect frame = [UIApplication sharedApplication].statusBarFrame;

    // simplified from: http://stackoverflow.com/a/25669695/219684

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

I'll try to do a pull request this weekend


was (Author: jcesarmobile):
This should fix all the issues:

{code}
@implementation CDVInAppBrowserNavigationController : UINavigationController

- (void) viewDidLoad {

    CGRect frame = [UIApplication sharedApplication].statusBarFrame;

    // simplified from: http://stackoverflow.com/a/25669695/219684

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

> Gray bar appears in the wrong place
> -----------------------------------
>
>                 Key: CB-10305
>                 URL: https://issues.apache.org/jira/browse/CB-10305
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin InAppBrowser
>    Affects Versions: 3.9.0
>            Reporter: Jacob Weber
>              Labels: iOS
>         Attachments: CordovaTest.zip, screen-1.png, screen-2.png, screen-3.png
>
>
> I'm seeing several issues on iOS with the gray semi-transparent overlay that appears
behind the status bar, when the InAppBrowser window is open.
> On Mac OS 10.11.2, create a project as follows (or use the attached CordovaTest project):
> {code}
> cordova --version   # prints 5.3.3
> cordova create CordovaTest com.jacobweber.cordovatest CordovaTest
> cd CordovaTest
> cordova platform add ios
> cordova plugin add cordova-plugin-inappbrowser
> platforms/ios/cordova/version   # prints 3.9.2
> {code}
> Edit {{platforms/ios/www/js/index.js}}, and add the following code at the end of {{onDeviceReady}}:
> {code}
> setTimeout(function(){
>   window.open("https://www.google.com", "_blank");
> }, 1000);
> {code}
> In Xcode, go to General > Deployment Info > iPad > Device Orientation, and check
all boxes.
> h4. Issue 1:
> * Open the Xcode project on Mac OS 10.11.2 using Xcode 7.2.
> * Launch on iPad Air simulator with iOS 9.2.
> * Launch in portrait, and wait for the window to open. Rotate to landscape. The gray
status bar doesn't extend all the way to the right. See screen-1.png.
> h4. Issue 2:
> * Open the Xcode project on Mac OS 10.10 using Xcode 6.2 (since El Capitan can't launch
an iOS 7 simulator).
> * Launch on iPad Air simulator with iOS 7.1.
> * Launch in landscape, and wait for the window to open. The gray status bar appears on
the left side. Rotate to portrait. The gray status bar is still on the left. See screen-2.png.
> h4. Issue 3:
> * Keep the iOS 7.1 simulator open. Launch a second time in landscape, and wait for the
window to open. Some of the time, the gray status bar appears vertically in the middle of
the screen. See screen-3.png.



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