Skip to main content
Fixing problem reported in comments
Source Link
Ash Furrow
  • 12.4k
  • 3
  • 59
  • 92

You won't be able to put an activity indicator in the nav bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

You won't be able to put an activity indicator in the nav bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

You won't be able to put an activity indicator in the nav bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

edited body
Source Link
Michael Robinson
  • 29.6k
  • 12
  • 109
  • 131

You won't be able to put an activity indicator in the nabnav bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

You won't be able to put an activity indicator in the nab bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

You won't be able to put an activity indicator in the nav bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.

Source Link
Ash Furrow
  • 12.4k
  • 3
  • 59
  • 92

You won't be able to put an activity indicator in the nab bar using only storyboards, unfortunately.

Create an instance variable for the activity indicator:

@implementation
{
    UIActivityIndicatorView *activityIndicator;
}
...

In your viewDidLoad method, instantiate it and add it to the navigation bar:

activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];

The property hidesWhenStopped is YES by default, so it will hide when it's not animating automatically. All you have to do is call startAnimating and stopAnimating when you want it to be visible or hidden, respectively.