I have a table view where some information is displayed in the subtitle of each cell. After a cell is deleted, this information needs to be recalculated. Here is my commitEditingStyle method:
My problem is that calling [tableView reloadData] interrupts the nice fading animation for deleting a row, and instead the delete is not animated. Is there any way to reload the data without interrupting the animation?
Code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
NSManagedObject *objectToDelete = [peopleArray objectAtIndex:indexPath.row];
[managedObjectContext deleteObject:objectToDelete];
[peopleArray removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView reloadData];
}
NSError *error = nil;
if (![managedObjectContext save:&error]) {
abort();
}
}
My problem is that calling [tableView reloadData] interrupts the nice fading animation for deleting a row, and instead the delete is not animated. Is there any way to reload the data without interrupting the animation?