As the Apple Doc said,
Reloading a row causes the table view to ask its data source for a new cell for that row.
I combine UITableView with NSFetchedResultsController:
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
if (self.tableView.isEditing)
{
[self.tableView setEditing:NO animated:YES];
}
[self.tableView beginUpdates];
}
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
{
[self.tableView endUpdates];
[self updateTabItemBadge];
[self.noDataView setHidden:![self isNoData]];
WXINFO(@"controllerDidChangeContent");
}
Between the above two functions, I reload the target cell:
case NSFetchedResultsChangeUpdate: {
if (indexPath) {
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
I set a breakpoint at Line1563, to check that the reloadRowsAtIndexPaths
has been called, but after that, - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
wasn't called.
So, my cell could not be updated.
Somebody can tell me why? Thanks.
Wrap it in:
[tableView beginUpdates];
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
[tableView endUpdates];
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