How to add an activity indicator for navigation?

Hey, I want to display an activity indicator in the right corner of my navigation bar when my user changes the selection on the selection wheel. I have no idea how to add an activity indicator there. I can only add the usual navigation buttons there. Any help? Thanks in advance!

+3
source share
1 answer
UIActivityIndicatorView *activityIndicator =  
[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];  
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] 
                                         initWithCustomView:activityIndicator];  
[[self navigationItem] setRightBarButtonItem:barButton];  

[barButton release];  
[activityIndicator startAnimating];  

That should work. From: http://iosdevelopertips.com/user-interface/adding-an-activity-indicator-spinner-to-navigation-bar.html

+7
source

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


All Articles