Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a loading message while UIWebView loads it's content?

Tags:

iphone

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?

like image 877
Alex Tau Avatar asked May 13 '10 06:05

Alex Tau


2 Answers

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

like image 96
Mihir Mehta Avatar answered Nov 13 '22 10:11

Mihir Mehta


Implement the UIWebView Delegate as outlined in Mihir's answer above but don't forget to assign the delegate otherwise the delegate methods will not be triggered

For example In ViewDidLoad you should add:

self.myWebView.delegate = self;
like image 29
HungryArthur Avatar answered Nov 13 '22 08:11

HungryArthur