I have a UITabBarController, and one of the panel items is a navigation controller with some buttons on it. One of the buttons opens urlRequest and loads it into 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 press the button for the first time, nothing happens.
I used the UIWebViewDelegate protocol to debug it as follows:
- (void)webViewDidStartLoad:(UIWebView *)webView
{
NSLog(@"webViewDidStartLoad");
}
When I click the button, nothing happens and I do not see the NSLog message. When I hit back and press the button again, I see the debug information and everything that can just be found.
Any idea what causes this?
PS if I put:
[self.navigationController pushViewController:tView animated:YES];
in the webViewDidStarLoad method, the application just hangs, because it does not load on the first click.
Tomer source
share