[
https://issues.apache.org/jira/browse/CB-11485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350115#comment-15350115
]
Shazron Abdullah edited comment on CB-11485 at 6/27/16 4:50 PM:
----------------------------------------------------------------
I fixed the issue by forcing the plugin to always use the width of the main
screen, I found that the plugin is setting the webview frame width to the
status bar width which was not updated yet after the orientation change
{code}
-(void)resizeWebView
{
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
if (isIOS7) {
CGRect bounds = [[UIScreen mainScreen] bounds];
bounds = [self invertFrameIfNeeded:bounds];
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication]
statusBarOrientation])) {
self.viewController.view.frame = bounds;
} else if (self.viewController.presentedViewController != nil) {
// https://issues.apache.org/jira/browse/CB-11018
BOOL isIOS8 = (IsAtLeastiOSVersion(@"8.0"));
BOOL isIOS9 = (IsAtLeastiOSVersion(@"9.0"));
if (isIOS8 && !isIOS9) {
// iOS 8
bounds = CGRectMake(0, 0, bounds.size.width,
bounds.size.height);
} else {
// iOS7, iOS9+
bounds = CGRectMake(0, 0, bounds.size.height,
bounds.size.width);
}
}
self.webView.frame = bounds;
if (!self.statusBarOverlaysWebView) {
CGRect statusBarFrame = [UIApplication
sharedApplication].statusBarFrame;
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
CGRect frame = self.webView.frame;
frame.origin.y = statusBarFrame.size.height;
frame.size.height -= statusBarFrame.size.height;
frame.size.width = [UIScreen mainScreen].bounds.size.width;
self.webView.frame = frame;
}
} else {
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
self.viewController.view.frame = bounds;
}
}
{code}
was (Author: yazeed.fares):
I fixed the issue by forcing the plugin to always use the width of the main
screen, I found that the plugin is setting the webview frame width to the
status bar width which was not updated yet after the orientation change
-(void)resizeWebView
{
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
if (isIOS7) {
CGRect bounds = [[UIScreen mainScreen] bounds];
bounds = [self invertFrameIfNeeded:bounds];
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication]
statusBarOrientation])) {
self.viewController.view.frame = bounds;
} else if (self.viewController.presentedViewController != nil) {
// https://issues.apache.org/jira/browse/CB-11018
BOOL isIOS8 = (IsAtLeastiOSVersion(@"8.0"));
BOOL isIOS9 = (IsAtLeastiOSVersion(@"9.0"));
if (isIOS8 && !isIOS9) {
// iOS 8
bounds = CGRectMake(0, 0, bounds.size.width,
bounds.size.height);
} else {
// iOS7, iOS9+
bounds = CGRectMake(0, 0, bounds.size.height,
bounds.size.width);
}
}
self.webView.frame = bounds;
if (!self.statusBarOverlaysWebView) {
CGRect statusBarFrame = [UIApplication
sharedApplication].statusBarFrame;
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
CGRect frame = self.webView.frame;
frame.origin.y = statusBarFrame.size.height;
frame.size.height -= statusBarFrame.size.height;
frame.size.width = [UIScreen mainScreen].bounds.size.width;
self.webView.frame = frame;
}
} else {
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
self.viewController.view.frame = bounds;
}
}
> Web view doesn't resize when switching from portrait mode to landscape
> -----------------------------------------------------------------------
>
> Key: CB-11485
> URL: https://issues.apache.org/jira/browse/CB-11485
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Statusbar
> Affects Versions: Master
> Environment: iOS 9.3, iPad
> Reporter: Yazeed Fares
>
> Web view doesn't resize when switching from portrait mode to landscape, the
> issue happens when you have a popover opened in a select field or when you
> open the camera picker.
> Screen shot ==> https://i.imgsafe.org/fa3905cbe2.png
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]