核心日期概念:NSFetchedResultsController与NSManagedObject objectsWithFetchRequest [英] Core Date Concept: NSFetchedResultsController vs. NSManagedObject objectsWithFetchRequest
问题描述
何时使用 NSFetchedResultsController 与进行比较NSManagedObject中的objectsWithFetchRequest 方法?有典型的情况吗?
objectsWithFetchRequest:
(或 executeFetchRequest:错误:
)只是执行获取请求并返回结果集。
A NSFetchedResultsController
执行提取请求,然后监视对数据存储的更改(或更精确地说,对受管理对象上下文的更改)。如果对象被添加/删除/修改,导致获取请求的结果集更改,它会调用代理函数报告更改。
A NSFetchedResultsController
在大多数情况下用于使用获取请求的结果填充表视图,并在对象被插入,删除或更改时自动更新表视图。/ p>
When do I use a NSFetchedResultsController in comparsion to the objectsWithFetchRequest method in NSManagedObject? Are there typical scenarios?
objectsWithFetchRequest:
(or executeFetchRequest:error:
) just executes a fetch request and returns the result set.
A NSFetchedResultsController
executes a fetch request and then monitors changes to the data store (or more precisely, changes to the managed object context). If objects are added/deleted/modified that cause the result set of the fetch request to change, it calls delegate functions to report the change.
A NSFetchedResultsController
is in most cases used to populate a table view with the result of a fetch request, and automatically update the table view if objects are inserted, deleted or changed.
这篇关于核心日期概念:NSFetchedResultsController与NSManagedObject objectsWithFetchRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!