简体   繁体   中英

activityIndicator not appearing

I have put an activtyIndicator on my webView and connected it with the files owner. I have an rss feed from a tableView and when I click on a cell, it pushes to the webView . Just like this tutorial. RSS Tutorial

However, when the webView starts loading, the activityIndicator doesn't appear at all. The code for my webView file for the activityIndicator is below:

-(void)webViewDidStartLoad:(UIWebView *)webView {
    [activityIndicator startAnimating];
    activityIndicator.hidden = NO;
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView {
    [activityIndicator stopAnimating];
    activityIndicator.hidden = YES;
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:FALSE];
}

Any ideas guys?

Thanks.

The most common mistake is that you forget to set the delegate of the webview: [theWebView setDelegate: self];

Do you do that already? Or, if you put any NSLog() in your webViewDidStartLoad , do you see the output?

Bring your subview to front. [self bringSubViewToFront:activityindicator];

I had the same problem, (having a UIActivityIndicator on top of my UIWebView), and couldn't see the activity indicator. This is what I did:

Put the activity indicator behind the uiwebview and initially hide the uiwebview, then when loading show the activity indicator. When it is finished loading hide the spinner and show the uiwebview.

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [spinner startAnimating];
    [spinner setHidden:FALSE];
    [loadButton setHidden:TRUE];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [spinner stopAnimating];
    [myWebView setHidden:FALSE];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM