核心日期概念:NSFetchedResultsController与NSManagedObject objectsWithFetchRequest [英] Core Date Concept: NSFetchedResultsController vs. NSManagedObject objectsWithFetchRequest

查看:287
本文介绍了核心日期概念:NSFetchedResultsController与NSManagedObject objectsWithFetchRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

何时使用 NSFetchedResultsController 进行比较NSManagedObject中的objectsWithFetchRequest 方法?有典型的情况吗?

解决方案

objectsWithFetchRequest:(或 executeFetchRequest:错误:)只是执行获取请求并返回结果集。



A NSFetchedResultsController 执行提取请求,然后监视对数据存储的更改(或更精确地说,对受管理对象上下文的更改)。如果对象被添加/删除/修改,导致获取请求的结果集更改,它会调用代理函数报告更改。



A NSFetchedResultsController 在大多数情况下用于使用获取请求的结果填充表视图,并在对象被插入,删除或更改时自动更新表视图。

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆