I need to perform
[[self tableView] reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];
after
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
// The fetch controller has sent all current change notifications, so tell the table view to process all updates.
[self.tableView endUpdates];
}
is done animating.
I want do that this way because I need to re-configure some cells in the section when a cell is deleted from the section. This is because the first and the last cell of the section have different backgrounds than the cells between them. A single cell has a different background all together. If I don't re-configure the cells left in the section, it could result in an akward view.
Calling reloadSections during controllerDidChangeContent is too soon and crashes because a cell can no longer be found.
If you want to pass more than 1 argument to a method with delay, wrap the method call in your own method:
- (void)reloadSections {
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1]
withRowAnimation:UITableViewRowAnimationNone];
}
Then when you want to reload:
[self performSelector:@selector(reloadSections) withObject:nil afterDelay:.2];
What about this?
[CATransaction begin];
[CATransaction setCompletionBlock:^{
// animation has finished
}];
[tableView beginUpdates];
// do some work
[tableView endUpdates];
[CATransaction commit];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With