I am trying to get a UIActivityIndicatorView to work inside of a UIButtonBarItem using the following code:
- (void)showActivityIndicator
{
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
[activityIndicator startAnimating];
UIBarButtonItem *activityBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];
[activityIndicator release];
self.navigationItem.rightBarButtonItem = activityBarButtonItem;
[activityBarButtonItem release];
}
It works to the point that the activity indicator is displayed, but it is not inside a button bar.
Does anyone have any ideas on what im doing wrong here?