I have another solution, because I have to put a spinner at detail view controller. Maybe it will help somebody.
- (void)viewDidLoad {
[super viewDidLoad];
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
self.spinner.hidesWhenStopped = YES;
[self.navigationController.view addSubview:self.spinner];
}
And for positioning:
-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
[self.navigationController.view setNeedsLayout];
[self.navigationController.view layoutIfNeeded];
self.spinner.frame = CGRectMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2, 10, 10);
}
Spinner will be always at center of your table view at detail view controller.