How do I add an activity indicator to my toolbar, like the Mail app does when it is checking for email?
If you want to add it through code, not though interface builder, you need to:
Here's a code sample:
- (void) showActivityIndicator{
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[activityView startAnimating];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:activityView];
NSArray *items = [[NSArray alloc] initWithObjects:item, nil];
[self.navigationController.toolbar setItems:items];
[items release];
[activityView release];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With