我有非常小的问题,同时加载在URL中UIWebView
。 我有一个UIButton
,就点击它,我添加UIView
其中包含UIWebView
, UIButton
和Title bar
。 使用代码如下 -
[self.view addSubview:vwOnline];
vwOnline.bounds = self.view.bounds;
//Load webview
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", objWine.strOnlineURL]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[wbvwOnline loadRequest:request];
- (void)webViewDidStartLoad:(UIWebView *)webView
{
//Show activity indicator
[indicator startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
//Remove Activity indicator
[indicator stopAnimating];
[indicator removeFromSuperview];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
NSLog(@"Error - %@", error);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Find A Vino" message:@"Error while loading request." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
alert.tag = 1;
//Remove Activity indicator
[indicator stopAnimating];
[indicator removeFromSuperview];
}
通过上面的代码做的,最次UIWebView
不加载URL
我传入对象objWine.strOnlineURL
。 如果我点击后退按钮和再次点击该按钮加载URL
,它进入- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
代表的方法UIWebView
。 如果有人知道的解决方案,那么请帮助我。