Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 通过NSFetchedResultsControllerDelegate协议进行单元格更新的差异?_Iphone_Objective C_Cocoa Touch_Uitableview - Fatal编程技术网

Iphone 通过NSFetchedResultsControllerDelegate协议进行单元格更新的差异?

Iphone 通过NSFetchedResultsControllerDelegate协议进行单元格更新的差异?,iphone,objective-c,cocoa-touch,uitableview,Iphone,Objective C,Cocoa Touch,Uitableview,我一直在在线查看NSFetchedResultsControllerDelegate协议参考和一些示例代码,并注意到在调用时更新UITableViewCell的两种不同实现: - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsC

我一直在在线查看NSFetchedResultsControllerDelegate协议参考和一些示例代码,并注意到在调用时更新UITableViewCell的两种不同实现:

- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
    atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
    newIndexPath:(NSIndexPath *)newIndexPath {
有人能解释这两种不同的方法吗

它们是:

// ONE
case NSFetchedResultsChangeUpdate:
[self configureCell:[tableView cellForRowAtIndexPath:indexPath]atIndexPath:indexPath];
break;


正如选择器的名称所暗示的那样,在一种情况下,单元格是用自定义方法(不是苹果的API)配置的,并且很可能在重新加载表视图时更新

在两种情况下是
UITableView
方法,其中可以“免费”获得动画效果。如何以及在何处更新单元格?没有密码就说不出来

// TWO
case NSFetchedResultsChangeUpdate:
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
break;