I have a UITableView supported by NSFetchedResultsController that can trigger updates at any time. If the user is currently reordering rows, applying these updates will throw an exception because the table view is temporarily captured and you get an error message like
Invalid update: invalid number of rows in section [...]
How can I determine when a user started moving a cell so that I can delay updates caused by the selected result controller? Apparently, there are no methods for delegating table views to detect this. This delegate method:
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath {
It is not called when the user first separates the first cell, only when they really move it somewhere else.
One solution is to check the isEditingreturned results in the queries and just in bulk reloadDatainstead of dynamically inserting / deleting rows, but I wonder if there is a way to specifically check the "reordering" mode.
source
share