refulgentis
By: a guest | Feb 9th, 2010 | Syntax:
None | Size: 1.78 KB | Hits: 73 | Expires: Never
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.
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.
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?
if (delegate) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ([delegate respondsToSelector:@selector(userDidPickItem:)]) {
MenuItem *pickedItem = nil;
if (tableView == self.searchDisplayController.searchResultsTableView)
pickedItem = [self.filteredListContent objectAtIndex:indexPath.row];
else
pickedItem = [fetchedResultsController objectAtIndexPath:indexPath];
[delegate performSelector:@selector(userDidPickItem:) withObject:pickedItem afterDelay:1.0];
}
}
Same for this code:
if (delegate) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ([delegate respondsToSelector:@selector(userDidPickItem:)]) {
MenuItem *pickedItem = nil;
if (tableView == self.searchDisplayController.searchResultsTableView)
pickedItem = [self.filteredListContent objectAtIndex:indexPath.row];
else
pickedItem = [fetchedResultsController objectAtIndexPath:indexPath]];
[NSThread detachNewThreadSelector:@selector(userDidPickItem:) toTarget:delegate withObject:pickedItem];
}
}