开发者

hiding network activity indicator

- (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;
}

I want to hide the network activity indicator after webpage is loaded. I had written the above code. But the indicator is not hiding after the webpage is fully loaded.

Anyone please help.


(1) The method should be called - (void)webViewDidFinishLoad:(UIWebView *)webView. The argument must present.

- (void)webViewDidFinishLoad:(UIWebView *)webView { 
    app.networkActivityIndicatorVisible = NO;
}

(2) Make sure you set self as a delegate of the web view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜