I want to know how to implement an activityIndicator in a WebView based app, I wrote the following code but the indicator does not appear.
The webview load file loca
Why are you setting your activity indicator to nil in your init?
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
//Initialization code
m_activity = nil;
}
return self;
}
The call to super initialized your indicator from your XIB (assuming you connected it to your outlet in IB), but then you are setting the reference to nil after it's been initialized. Remove that line. Then go back into interface builder and set the "Hide when stopped" checkbox. Now you can simplify your code that displays the indicator:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[m_activity stopAnimating];
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
[m_activity startAnimating];
}
The "Hide when stopped" causes the indicator to hide when you stop it from animating.