Add Activity Indicator to Navigation Controller Bar


/ Published in: Objective C
Save to your folder(s)

This adds a spinning activity indicator to the top navigation bar of a navigation controller.


Copy this code and paste it in your HTML
  1. // stop activity indicator
  2. UINavigationController *tempNavigationController = [self.navigationController.viewControllers objectAtIndex:2];
  3. CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
  4. UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc] initWithFrame:frame];
  5. [loading sizeToFit];
  6. loading.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);
  7. UIBarButtonItem *statusInd = [[UIBarButtonItem alloc] initWithCustomView:loading];
  8. statusInd.style = UIBarButtonItemStylePlain;
  9. [tempNavigationController.navigationItem setRightBarButtonItem: statusInd animated:YES];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.