tags:

views:

128

answers:

1

I want to put a big spinner along with a "Loading message..." or a gif image, when UIWebView loads its contents so it won't just show a blank view. How should I do it?

+1  A: 

implement UIWebview's delegate method put this code in it

- (void)webViewDidStartLoad:(UIWebView *)webView {
    [activityIndicator startAnimating];
    myLabel.hidden = FALSE;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicator stopAnimating];
myLabel.hidden = TRUE;
}

set ActivityIndicater's Hidden when stop property to TRUE

mihirpmehta
it doesn't work. everything is connected in IB. the label is above everything, but still, it doesn't show at all.
Did you set the delegate? I'm using some almost identical code, and it does the job. The only difference with mine is I display the label in the viewDidLoad, as I only need it once.
alku83
The delegate is set. I am using -webviewdidfinish/start loading to turn on/off network activity indicator.
I am not using label but just using activityIndicator... but it is working fine... for time being remove Label and see if it is working fine with activityIndicator Or not... and also put break point in both function to see if code is actually executed or not
mihirpmehta