Detect when a UITableView is being reordered
Posted
by Mike Weller
on Stack Overflow
See other posts from Stack Overflow
or by Mike Weller
Published on 2010-04-27T11:43:04Z
Indexed on
2010/04/27
11:53 UTC
Read the original article
Hit count: 269
iphone
|uitableview
I have a UITableView backed by an NSFetchedResultsController which may trigger updates at any time. If the user is currently reordering rows, applying these updates will cause an exception because the table view has temporarily taken over and you get an error like
Invalid update: invalid number of rows in section [...]
How can I detect when the user has started moving a cell so I can delay updates caused by the fetched results controller? There don't seem to be any table view delegate methods to detect this. This delegate method:
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath {
Doesn't get called when the user initially detaches the first cell, only when they actually move it somewhere else.
© Stack Overflow or respective owner