I am using the following code to add a “Spinner” on top of my UITableView:
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[spinner setCenter:CGPointMake(120,162)];
[self.view addSubview:spinner];
spinner.backgroundColor = [UIColor lightGrayColor];
spinner.hidesWhenStopped = YES;
[spinner stopAnimating];
This works fine, but when I scroll to the bottom of the UITableView and invoke the spinner, the spinner is still up at the top of the table view, at position 120,162. I would like to have it positioned at 120, 162 – independent of what position the UITableView is in.
you could either add a new subclassed UITableCell with the spinner in it and add it to the end of your table and take it away when you would normally stop the animation, or have a parent view hold your table view and put the spinner in the parent rather than as a child of your table view. I assume your tableview is the view for your viewcontroller?