I know this has been discussed several times already but can't figure out why my activity indicator is not working.
What I want: UIActivityIndicator is visible and starts animating while a webpage is loading and hides automatically when the load is finished.
What I have: UIActivityIndicator is not hiding or animating, is shown fixed in the centre of my view.
Note: The outlet indicator
is connected to the IB object in IB (see screenshot).
H FILE:
#import <UIKit/UIKit.h>
@interface AbschlagViewController : UIViewController <UIWebViewDelegate>
{
IBOutlet UIActivityIndicatorView *indicator;
}
@property (strong, nonatomic) IBOutlet UIWebView *abschlagWebView;
@property (strong, nonatomic) UIActivityIndicatorView *indicator;
@end
M FILE:
@synthesize abschlagWebView, indicator;
- (void)webViewDidStartLoad:(UIWebView *)webView
{
indicator.hidden = FALSE;
[indicator startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
indicator.hidden = TRUE;
[indicator stopAnimating];
}
IB Screenshot:
Set the delegate
for the UIWebView
instance, so that webViewDidStartLoad
and webViewDidFinishLoad
methods are called?