Stop activity indicator in status bar?

I am almost completing my application, but I have a problem. Obviously, for my web view, I need an activity indicator for the application. I already have the following:

- (void)viewDidLoad { [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]]]; // I removed the website for privacy sake [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } 

The problem is that it will not stop rotating when I need it (for example, even after loading the page, it does not stop)

Any suggestions? Any help is appreciated!

+4
source share
3 answers

Paste the UIWebViewDelegate into your class file that contains the UIWebView and paste the following two methods:

 - (void)webViewDidStartLoad:(UIWebView *)webView - (void)webViewDidFinishLoad:(UIWebView *)webView 

In the start method put your:

 [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; 

... and at the finish, place:

 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 

Hope this helps!

+9
source

In the web view delegate, you can:

 - (void)webViewDidFinishLoad:(UIWebView *)webView { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; } 
+2
source

you need to call

 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 

to stop him

+1
source

All Articles