In your .m file (no need to do this in .h unless you need to do this from another class):
@interface MyClass ()
@property (strong, nonatomic) UIActivityIndicatorView *spinner;
@end
@implementation MyClass
- (void)someMethod
{
// where you were calling the code from your post, do this:
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
self.spinner.center = CGPointMake(160, 500);
self.spinner.hidesWhenStopped = YES;
[self.view addSubview:self.spinner];
[self.spinner startAnimating];
}
- (void)someOtherMethod
{
[self.spinner stopAnimating];
}