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?
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
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With