Answer

The UIToolBar uses UIBartButtonItems for adding buttons. The key here is to create a UIBarButtonItem with the UIActivityIndicatorView as a custom view. Then add that button to say right side of toolbar. Rest invoke startAnimating on the activity indicator to display the activity indicator rotating circle, do the task and invoke stop when done.

Snippet

  1.     UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
  2.  
  3.     [activityIndicator startAnimating];
  4.  
  5.     UIBarButtonItem *activityItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator];
  6.  
  7.      self.navigationItem.rightBarButtonItem = activityItem;
  8.  
  9.     [activityItem release];
  10.  
  11.     --- do the task -----
  12.  
  13.    [activityIndicator stopAnimating];