I had your same problem for UIWebView inside a UIPageViewController and I found a better solution.
If you are in FirstViewController
and you have your webView in your SecondViewController
put the loadHTMLString
or loadRequest
method in the viewDidLoad
of your SecondViewController
and call [secondViewController.view layoutSubviews]
for start loading in your FirstViewController
.
Ex:
FirstViewController
-(void)viewDidLoad{
[super viewDidLoad];
// _secondViewController -> An instance of SecondVieController
[_secondViewController.view layoutSubviews];
}
SecondViewController
-(void)viewDidLoad{
[super viewDidLoad];
NSURL *url =[NSURL URLWithString:@"http://www.google.it"];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}