UITableViewCell accessoryView not appearing until much later
I've got a UITableView with several entries. Upon selecting one, I need it to do a potentially time-consuming network operation. To give the user some feedback, I tried to place a UIActivityIndicatorView in the UITableViewCell. However, the spinner doesn't appear until much later -- after I've done the expensive operation! What am I doing wrong?

    - (NSIndexPath *) tableView:(UITableView *) tableView
       willSelectRowAtIndexPath:(NSIndexPath *) indexPath {
      
      UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]
                                           initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
      
      [spinner autorelease];
      [spinner startAnimating];
      [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:activity];
      
      if ([self lengthyNetworkRequest] == nil) {
        // ...
        
        [spinner stopAnimating];
        [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:nil];
        
        return nil;
      }
        
      [spinner stopAnimating];
      [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:nil];

      return indexPath;
    }
UITableViewCell accessoryView not appearing until much later
===

I've got a UITableView with several entries. Upon selecting one, I need it to do a potentially time-consuming network operation. To give the user some feedback, I tried to place a UIActivityIndicatorView in the UITableViewCell. However, the spinner doesn't appear until much later -- after I've done the expensive operation! What am I doing wrong?

    - (NSIndexPath *) tableView:(UITableView *) tableView
       willSelectRowAtIndexPath:(NSIndexPath *) indexPath {
      
      UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]
                                           initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
      
      [spinner autorelease];
      [spinner startAnimating];
      [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:activity];
      
      if ([self lengthyNetworkRequest] == nil) {
        // ...
        
        [spinner stopAnimating];
        [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:nil];
        
        return nil;
      }
        
      [spinner stopAnimating];
      [[tableView cellForRowAtIndexPath:indexPath] setAccessoryView:nil];

      return indexPath;
    }