【问题标题】:Swift: Difference between NSFetchRequest and NSFetchResultsController?Swift:NSFetchRequest 和 NSFetchResultsController 之间的区别?
【发布时间】:2020-06-10 17:51:58
【问题描述】:

我很难理解 NSFetchRequest 和 NSFetchResultsController 之间的区别。 我也不知道在什么情况下我会选择其中的哪一个。

如果有人能简单地解释一下,我会很高兴的。

【问题讨论】:

    标签: ios swift core-data nsfetchedresultscontroller nsfetchrequest


    【解决方案1】:

    NSFetchRequest 是您想从NSManagedObjectContext 中获取的NSManagedObjects 集合的简单静态描述。

    NSFetchResultsController 帮助管理在 (NS/UI) TableView/CollectionView 中使用的对象。 NSFetchRequest 返回的对象集可以随着对象在 NSManagedObjectContext 中被编辑/插入/删除而改变。 NSFetchResultsController 将帮助您跟踪这些变化。

    NSFetchResultsController 配置有NSFetchRequest

    【讨论】:

    • ...还有值得一提的 UICollectionView
    猜你喜欢
    • 1970-01-01
    • 2021-12-25
    • 2020-05-10
    • 2014-09-20
    • 2010-10-28
    • 2015-10-04
    • 2012-08-12
    • 2011-02-18
    • 2019-12-21
    相关资源
    最近更新 更多