Adding a UIActivityIndicator to a UIToolbar
The key is to set the activity indicator as the custom view in a UIBarButtonItem:
self.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.activityBarItem.customView = self.loadingIndicator;
That's all there is to it. You can create the bar item in IB and then create the indicator in the controller. Once you've created the indicator, just assign it to the customView property of the UIBarButtonItem. You'll want to set the width of the UIBarButtonItem to 20px in IB. I love simple solutions!


