Activity indicator does not hide when loading a web page

The activity indicator is not hidden when the web page has finished loading. Here is my

.h file

@interface PropertyViewController : UIViewController{ IBOutlet UIWebView *propertyNexusHome; IBOutlet UIActivityIndicatorView *wheel; NSTimer *timer; } 

.m file

 - (void)viewDidLoad { [super viewDidLoad]; [property loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.google.com"]]]; [property addSubview:wheel]; timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES]; // Do any additional setup after loading the view, typically from a nib. } -(void)loading { if (!property.loading) [wheel stopAnimating]; else [wheel startAnimating]; } @end 

I’m not sure why it doesn’t disappear, no matter how it stops spinning when the page loads.

Thanks in advance.

+4
source share
2 answers

Another option is to set [wheel setHidesWhenStopped:YES] when creating an activity indicator.

+10
source

You must add:

 wheel.hidden = YES; 

when he stops the animation

0
source

Source: https://habr.com/ru/post/1499398/


All Articles