I have a UITableView that I want to edit inside of a UITableViewController. This code is from the method that I call to edit the tableView.
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject: path] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject: path] withRowAnimation:UITableViewRowAnimationNone];
NSMutableArray *things = [[self.fetchedResultsController fetchedObjects] mutableCopy];
self.storedCell = [things objectAtIndex: path.row];
[things removeObjectAtIndex: path.row];
for ( int i = 0; i < [things count]; i++) {
Task *mo = (Task *)[things objectAtIndex: i];
[mo setValue:[NSNumber numberWithInt: i] forKey:@"displayOrder"];
}
[things release]; things = nil;
self.newPath = path;
[self.managedObjectContext save: nil];
[self.tableView endUpdates];
and this is the error that is thrown:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to create two animations for cell'
Any ideas on what I’ve done wrong?
Instead of deleting and then inserting the same row, if that’s what you want to do, just reload it:
However, it looks like you should just be deleting the row so you should probably just remove the
insertRowsAtIndexPathsline. (Of course, you didn’t post all of the code so I don’t know for sure….)