- (void)viewWillAppear:(BOOL)animated {
app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = YES;
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
-(void)webViewDidFinishLoad {
app.networkActivityIndicatorVisible = NO;
}
我希望在加载网页后隐藏网络活动指示符。我写了上面的代码。但是在网页完全加载后,指标并未隐藏。
任何人都请帮忙。
答案 0 :(得分:1)
(1)该方法应称为- (void)webViewDidFinishLoad:(UIWebView *)webView
。论证必须出现。
- (void)webViewDidFinishLoad:(UIWebView *)webView {
app.networkActivityIndicatorVisible = NO;
}
(2)确保将self
设置为Web视图的委托。