How do I add a UIActivityIndicatorView spinner circle into a UIBarButton, so that when a user taps on one of those buttons on the navigation bar, they see a spinner while the lo
Use this Methods
-(void)startAniatingActivityIndicator{
@try {
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityIndicator.frame = CGRectMake(self.window.frame.size.width-30, 32.5, activityIndicator.bounds.size.width, activityIndicator.bounds.size.height);
[self.window addSubview:activityIndicator];
[activityIndicator startAnimating];
[self.window bringSubviewToFront:activityIndicator];
}
@catch (NSException *exception) {
}
@finally {
}
}
-(void)stopAniatingActivityIndicator{
[activityIndicator stopAnimating];
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}