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

Shazron Abdullah updated CB-5893:
---------------------------------

    Labels: statusbar-plugin  (was: )

> Using StatusBar with StatusBarOverlaysWebView = false on iPad creates only 
> 20px wide webview frame
> --------------------------------------------------------------------------------------------------
>
>                 Key: CB-5893
>                 URL: https://issues.apache.org/jira/browse/CB-5893
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugins
>    Affects Versions: 3.3.0
>         Environment: iOS 7, iPad (2, iPad Mini (retina), iPad Air)
>            Reporter: Hans-Gunther Schmidt
>              Labels: statusbar-plugin
>
> When using the statusbar plugin (org.apache.cordova.statusbar) in a Cordova 
> (and PhoneGap) app built for iOS we experience an issue on iPads: when 
> opening the app on an iPad in *Landscape* (left, right) mode, the whole 
> webview seems to only be contained in an 20px by <device-width> viewable 
> frame (basically we can only see parts of our header bar).
> How to reproduce:
> {code}
> $ npm install -g cordova
> $ cordova create hello com.example.hello Hello
> $ cd hello
> $ cordova platform add ios
> $ cordova plugin add org.apache.cordova.statusbar
> $ cordova build ios
> {code}
> Then create an iOS build as given below:
> - open {{platforms/ios/Hello.xcodeproj/}} in Xcode
> - adapt {{StatusBarOverlaysWebView}} in {{config.xml}}:
> {code}
> <preference name="StatusBarOverlaysWebView" value="true" />
> {code}
> to
> {code}
> <preference name="StatusBarOverlaysWebView" value="false" />
> {code}
> - set target device to _iPhone_ (= not _Universal_)
> - set target version _7.0_
> - set device orientation to _Portrait_ (= not _Upside Down_, _Landscape left 
> | right_)
> - physically turn your connected iPad into either landscape left/right 
> position
> - deploy to your iPad
> Happens to us with iPad 2, iPad Air and iPad Mini (retina) with Cordova 
> *3.3.1-0.1.2*. We also see this issue when using PhoneGap *3.1.0-0.15.0* and 
> *3.3.0-0.19.1*.
> From poking around and adding log messages to {{setStatusBarOverlaysWebView}} 
> we do see that the calculated values might be incorrect.
> {code:title=|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];
>         self.webView.frame = bounds;
>     } else {
>         CGRect statusBarFrame = [UIApplication 
> sharedApplication].statusBarFrame;
>         [self initializeStatusBarBackgroundView];
>         CGRect frame = self.webView.frame;
>         if 
> (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
>             frame.origin.y = statusBarFrame.size.width;
>             frame.size.height -= statusBarFrame.size.width;
>         } else {
>             frame.origin.y = statusBarFrame.size.height;
>             frame.size.height -= statusBarFrame.size.height;
>         }
>         
>         NSLog(@"frame  | %f | %f | %f | %f |", frame.origin.x, 
> frame.origin.y, frame.size.width, frame.size.height);
>         self.webView.frame = frame;
>         NSLog(@"self.webview.frame  | %f | %f | %f | %f |", 
> self.webView.frame.origin.x, self.webView.frame.origin.y, 
> self.webView.frame.size.width, self.webView.frame.size.height);
>         [self.webView.superview addSubview:_statusBarBackgroundView];
>     }
>     
>     _statusBarOverlaysWebView = statusBarOverlaysWebView;
> }
> {code}
> The NSLog statements will print out:
> {code:title=log output|borderStyle=solid}
> [...]
> 2014-01-24 18:17:02.780 HelloCord[7877:60b] frame  | 0.000000 | 480.000000 | 
> 320.000000 | -20.000000 |
> 2014-01-24 18:17:02.783 HelloCord[7877:60b] self.webview.frame  | 0.000000 | 
> 460.000000 | 320.000000 | 20.000000 |
> [...]
> {code}
> This would (and does) translate into a webview frame (when holding the iPad 
> back in Portrait mode again):
> - x = 0 (OK)
> - y = 460px (all the way down ... NOT OK)
> - width = 320px (from left to right screen border ... OK)
> - height = 20px (NOT OK)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to