I have a UITableViewController and when I push a particular view onto the stack it takes forever so I wanted to add a spinner to the cell before moving along. The problem I'm having is that the spinner gets added after the new view gets pushed onto the controller stack. But I thought that messages were synchronous?
So how can I make this spinner display before moving onto the next view? Thanks in advance!
- (void)
tableView: (UITableView *) tableView
didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
UITableViewCell *cell = [ self.tableView cellForRowAtIndexPath: indexPath ];
if (cell.accessoryType == UITableViewCellAccessoryDisclosureIndicator) {
UIActivityIndicatorView *activityIndicator = [ [ UIActivityIndicatorView alloc ] initWithFrame: CGRectMake(260.0, 10.0, 25.0, 25.0) ];
activityIndicator.hidesWhenStopped = YES;
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[ cell addSubview: activityIndicator ];
[ activityIndicator startAnimating ];
TableDemoViewController *newViewController = [ [ TableDemoViewController alloc ] initWithPath: cell.textLabel.text ];
UINavigationController *navigationController = [ appDelegate navigationController ];
[ navigationController pushViewController: newViewController animated: YES ];
[ activityIndicator stopAnimating ];
}
}