views:

95

answers:

1
- (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  A: 

(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.

KennyTM
Yes. It worked!! Thanks a lot!!
iSharreth