I am trying to load a web view (called widget) and set an indicator (called indicator) to show that the view is loading (the web page is no larger than http://www.google.com). The widget loads fine (I haven’t included that code) but this snippet, which should send startAnimating to a UIActivityIndicatorView is not working (no animation or even appearance). Everything is connected in storyboard and “not loading” is always logged. This makes me think there is something wrong with my use of UIWebView’s loading property.
sleep(2);
[super viewDidLoad];
[indicator setHidesWhenStopped:YES];
if (widget.loading == YES) {
NSLog(@"loading");
[indicator startAnimating];
} else {
NSLog(@"not loading");
[indicator stopAnimating];
}
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
Any thoughts?
Thanks
Try putting your start and stop animating in the delegate methods for the webview:
Make sure you set the webview’s delegate and are conforming to UIWebViewDelegate in your interface.