Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C: How to add spinner to navigation bar

I have an issue of locking my screen whenever I try to refresh my page.

How can I load data from the server and add a spinner to the navigation bar (like instagram) without locking my screen?

enter image description here

like image 213
Zhen Avatar asked Jan 20 '23 00:01

Zhen


2 Answers

To add spinner you can do something like

    UIActivityIndicatorView *ai = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:ai] autorelease]; 
   [ai startAnimating];
   [ai release];

What about locking? I didn't understand.

like image 171
Evgeny Shurakov Avatar answered Feb 02 '23 05:02

Evgeny Shurakov


You might want to look at this open source project for what you need, several examples are there for you to consult.

The MBProgressHUD displays a translucent HUD with a progress indicator and some optional labels while work is being done in a background thread

like image 23
Hoang Pham Avatar answered Feb 02 '23 04:02

Hoang Pham