I got a UITabBarController and one of the bar items is a Navigation Controller with some buttons on it. One of the buttons opens up a urlRequest and load it in a UIWebView.
NSURL * url = [NSURL URLWithString:myUrl];
NSURLRequest * urlRequest = [NSURLRequest requestWithURL:url];
UIWebView * web = [tView wView];
[web setScalesPageToFit:YES];
[web loadHTMLString:@"Loading" baseURL:nil];
[web loadRequest:urlRequest];
[self.navigationController pushViewController:tView animated:YES];
For some reason when i click the button for the first time nothing happens.
I used the UIWebViewDelegate protocol to debug it like so:
- (void)webViewDidStartLoad:(UIWebView *)webView
{
NSLog(@"webViewDidStartLoad");
}
When i click the button nothing happens, and i don't see the NSLog message. When i hit back and click the button again, i see the debug and everything works just find.
Any idea what causing this ?
P.S if i put the :
[self.navigationController pushViewController:tView animated:YES];
in the webViewDidStarLoad method the application just hang, since it's not loading it on the first click.