简体   繁体   English

iPhone:如何在添加新对象时更新显示托管对象的表视图

[英]Iphone: How to update a table view that displays managed objects when new object is added

I have a table view that displays managed objects (Tasks). 我有一个显示托管对象(任务)的表视图。 I'd like to fetch all tasks and update the table view once a task is added or modified. 一旦添加或修改任务,我想获取所有任务并更新表视图。

Currently refresh the tasks array when NSManagedObjectContextDidSaveNotification is fired. 当前在激发NSManagedObjectContextDidSaveNotification时刷新任务数组。 But I'm afraid that this could be quite inefficient as the table is also updated when other objects are modified. 但是我担心这可能效率很低,因为在修改其他对象时也会更新表。

Is there any way to update my table view only when the Tasks relation is changed? 仅在“任务”关系更改时,有什么方法可以更新我的表视图吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM