Reputation: 3860
Hey, I want to display an activity indicator on the right corner of my navbar when my user changes selection in picker wheel. I have no idea how to add activity indicator there I am only able to add normal navbar buttons there. Any help? Thanks in advance!
Upvotes: 3
Views: 1072
Reputation: 4989
UIActivityIndicatorView *activityIndicator =
[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
UIBarButtonItem *barButton = [[UIBarButtonItem alloc]
initWithCustomView:activityIndicator];
[[self navigationItem] setRightBarButtonItem:barButton];
[barButton release];
[activityIndicator startAnimating];
This should work. From: http://iosdevelopertips.com/user-interface/adding-an-activity-indicator-spinner-to-navigation-bar.html
Upvotes: 7