You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/09/18 04:28:36 UTC

ios commit: [CB-1465] WebView too small after closing of a ChildBrowser in landscape orientation

Updated Branches:
  refs/heads/master 4bdfe36aa -> 681016b3e


[CB-1465] WebView too small after closing of a ChildBrowser in landscape orientation


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/681016b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/681016b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/681016b3

Branch: refs/heads/master
Commit: 681016b3e0e7e006657406fc0158aaa8515c3369
Parents: 4bdfe36
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Sep 17 19:28:28 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Sep 17 19:28:28 2012 -0700

----------------------------------------------------------------------
 .../__TESTING__/Classes/MainViewController.m       |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/681016b3/bin/templates/project/__TESTING__/Classes/MainViewController.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/Classes/MainViewController.m b/bin/templates/project/__TESTING__/Classes/MainViewController.m
index d0a55bf..91c8753 100644
--- a/bin/templates/project/__TESTING__/Classes/MainViewController.m
+++ b/bin/templates/project/__TESTING__/Classes/MainViewController.m
@@ -52,8 +52,13 @@
 {
     // Set the main view to utilize the entire application frame space of the device.
     // Change this to suit your view's UI footprint needs in your application.
-    self.view.frame = [[UIScreen mainScreen] applicationFrame];
-    
+
+    UIView* rootView =[[[[UIApplication sharedApplication] keyWindow] rootViewController] view];
+    CGRect webViewFrame = [[[rootView subviews] objectAtIndex:0] frame];  // first subview is the UIWebView
+    if (CGRectEqualToRect(webViewFrame, CGRectZero)) { // UIWebView is sized according to its parent, here it hasn't been sized yet
+        self.view.frame = [[UIScreen mainScreen] applicationFrame]; // size UIWebView's parent according to application frame, which will in turn resize the UIWebView
+    }
+
     [super viewWillAppear:animated];
 }