views:

79

answers:

1

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.

A: 

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?

AtomRiot
I tired [self.parentView.view addSubview:mySubview] and it is acting weird. If I don't ever hide the spinner, it stays on the screen in the position that I want. If I hide the spinner and then make it appear, it sticks to the top of the UITableView and scrolls off the screen with the UITableView
Chris
I had to change waitUntilDone:YES to waitUntilDone:NO
Chris