Reputation: 3875
I made a subclass of UIViewController.
It has a UIWebView property called *_webview
.
When I set that UIViewController's view
property to be _webview, I stop getting notifications from my view. So I can't implement any method with the delegate, not even viewDidLoad! I am not sure why it is happening or what am I doing wrong
Upvotes: 0
Views: 676
Reputation: 318774
Don't set the view controller's view to be the web view. In the viewDidLoad
method, create the UIWebView
and add it as a subview of the view controller's view. Something like this:
- (void)viewDidLoad {
[super viewDidLoad];
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
// setup rest of webView properties such a delegate, etc.
webView.autoresizingMask = UIViewAutoresizingMaskFlexibleWidth | UIViewAutoresizingMaskFlexibleHeight;
[self.view addSubview:webView];
}
This will make the web view fill the view controller. This code assumes ARC. No web view property is needed unless you need to reference the web view from any methods other than the delegate methods.
Upvotes: 2