Place this in the .h file
// inside the interface
// inside the interface
IBOutlet UIActivityIndicatorView *activityIndicator;
// outside the interface
@property (nonatomic, assign) UIActivityIndicatorView *activityIndicator;
Place in this .m file
in the synthesize section
@synthesize activityIndicator;
// inside viewDidLoad
-(void) viewDidLoad
{
...
self.activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[self.view addSubview:self.activityIndicator];
self.activityIndicator.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);
activityIndicator.hidden = YES;
}
// inside the place to activate the spinner
[self.activityIndicator startAnimating];
// inside the place to stop the spinner
[self.activityIndicator stopAnimating];
No comments:
Post a Comment