I can't get my activity indicator to work.
Here's what I've got-
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
//Create an instance of activity indicator view
UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
//set the initial property
[activityIndicator stopAnimating];
[activityIndicator hidesWhenStopped];
//Create an instance of Bar button item with custome view which is of activity indicator
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];
//Set the bar button the navigation bar
[self navigationItem].rightBarButtonItem = barButton;
//Memory clean up
[activityIndicator release];
[barButton release];
}
The part of the code that is supposed to get it started and then ended--
...
else if ([theSelection isEqualToString: @"Update statistics"])
{
[self startTheAnimation];
[updateStatistics updateThe2010Statistics];
[self stopTheAnimation];
}
...
-(void)startTheAnimation {
[(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView startAnimating];
}
-(void)stopTheAnimation {
[(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView stopAnimating];
}