如何防止NSFetchedResultsController在控制器消失时更新tableview?

Ale*_*one 6 iphone core-data objective-c nsfetchedresultscontroller ios

I have a UITabbar with multiple controllers in it. One of the controllers is used to add Events to Core Data, while another controller is used to display events as in a UITableView using NSFetchedResultsController.

Here's the behaviour that I would like to achieve: Upon disappearing, the UITableView stops updating, and when the user comes back, the entire table view is reloaded. Otherwise, inserting events from the other controller takes longer, as new rows are created in the UITableView, even thought it is not visible.

I'm wondering how I can achieve this behavior, as it doesn't seem to work as I expect it would be:

I have set the delegate of the NSFetchedResultsController to nil in viewWillDisappear, and restore it in viewWillAppear, along with a call to [UITableView reloadData];

不知何故,我没有看到新数据,并怀疑这是由于NSFetchedResultsController如果没有委托就停止提取的方式.

如何UITableView在消息消失时正确"暂停"更新,但在控制器重新出现时仍能看到整个数据集?

rob*_*off 7

尝试发送performFetch:NSFetchedResultsControllerviewWillAppear:您设置其委托回后self.