How to add activity indicator to navbar?
-
30-09-2019 - |
Question
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!
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow