You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/12/13 15:55:19 UTC
ios commit: CB-5583 WebView doesn't properly initialize when
instantiated from a xib
Updated Branches:
refs/heads/master b0c71bf63 -> 1f4596b86
CB-5583 WebView doesn't properly initialize when instantiated from a xib
Limit createGapView to create and position webView, configure delegate
and register with NSURLProtocol in viewDidLoad. When `self.webView` is
created outside this class (e.g. created from Nib) then `viewDidLoad`
won't properly configure the webView's `delegate` or register with
`NSURLProtocol` properly.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/1f4596b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/1f4596b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/1f4596b8
Branch: refs/heads/master
Commit: 1f4596b869b6e3622a2fdc20bcbc0a0b392799fa
Parents: b0c71bf
Author: 利辺羅エルネスト <ri...@cyberagent.co.jp>
Authored: Thu Nov 7 19:06:17 2013 +0900
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Dec 13 09:52:31 2013 -0500
----------------------------------------------------------------------
CordovaLib/Classes/CDVViewController.m | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1f4596b8/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 7eec134..a8d2c47 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -242,7 +242,16 @@
// // Instantiate the WebView ///////////////
- [self createGapView];
+ if (!self.webView) {
+ [self createGapView];
+ }
+
+ // Configure WebView
+ _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
+ self.webView.delegate = _webViewDelegate;
+
+ // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set
+ [CDVURLProtocol registerViewController:self];
// /////////////////
@@ -555,19 +564,11 @@
webViewBounds.origin = self.view.bounds.origin;
- if (!self.webView) {
- self.webView = [self newCordovaViewWithFrame:webViewBounds];
- self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-
- [self.view addSubview:self.webView];
- [self.view sendSubviewToBack:self.webView];
+ self.webView = [self newCordovaViewWithFrame:webViewBounds];
+ self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
- _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
- self.webView.delegate = _webViewDelegate;
-
- // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set
- [CDVURLProtocol registerViewController:self];
- }
+ [self.view addSubview:self.webView];
+ [self.view sendSubviewToBack:self.webView];
}
- (void)didReceiveMemoryWarning