Share Pastebin
Guest
Public paste!

refulgentis

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 1.78 KB | Hits: 73 | Expires: Never
Copy text to clipboard
  1. Issue: If there is any additional call in [tableView:didSelectRowAtIndexPath:] besides [tableView deselectRowAtIndexPath:indexPath animated:YES], all visible tableviews in the window will deselect their selected rows, and the table view that was just selected will animated the deselection very quickly, as if its starved for CPU.
  2.  
  3. The only thing that makes the issue completely disappear is to comment out any calling of userDidPickerItem on the delegate, or choosing a really long delay, which will still not help if the users rapidly taps rows.
  4.  
  5. FWIW, I wrapped the code in the if branch inside CFAbsoluteGetTimeCurrent() calls, and it reports the whole block is returning within 0.003 of a second. What gives?
  6.  
  7. if (delegate) {
  8.                 [tableView deselectRowAtIndexPath:indexPath animated:YES];
  9.                
  10.                 if ([delegate respondsToSelector:@selector(userDidPickItem:)]) {
  11.                         MenuItem *pickedItem = nil;
  12.                        
  13.                         if (tableView == self.searchDisplayController.searchResultsTableView)
  14.                                 pickedItem = [self.filteredListContent objectAtIndex:indexPath.row];
  15.                         else
  16.                                 pickedItem = [fetchedResultsController objectAtIndexPath:indexPath];
  17.                        
  18.                         [delegate performSelector:@selector(userDidPickItem:) withObject:pickedItem afterDelay:1.0];
  19.                 }
  20.         }
  21.  
  22. Same for this code:
  23. if (delegate) {
  24.                 [tableView deselectRowAtIndexPath:indexPath animated:YES];
  25.                
  26.                 if ([delegate respondsToSelector:@selector(userDidPickItem:)]) {
  27.                         MenuItem *pickedItem = nil;
  28.                        
  29.                         if (tableView == self.searchDisplayController.searchResultsTableView)
  30.                                 pickedItem = [self.filteredListContent objectAtIndex:indexPath.row];
  31.                         else
  32.                                 pickedItem = [fetchedResultsController objectAtIndexPath:indexPath]];
  33.                        
  34.                         [NSThread detachNewThreadSelector:@selector(userDidPickItem:) toTarget:delegate withObject:pickedItem];
  35.                 }
  36.         }