gpt4 book ai didi

ios - 在 UITableViewController 之外使用 NSFetchedResultsController

转载 作者:行者123 更新时间:2023-11-29 05:05:29 25 4
gpt4 key购买 nike

UITableViewController 之外使用 NSFetchedResultsController 会不会是错误的,因为非 UITableView Controller 无法实现 NSFetchedResultsControllerDelegate 协议(protocol)?

最佳答案

没有什么特殊原因不能在没有表的情况下使用 NSFetchedResults Controller 。您可以定义任意类来实现 NSFetchedResultsControllerDelegate 协议(protocol)。

但是,很少有任何特定原因让您想要这样做。 FRC 旨在获取和排序表的数据。它还跟踪部分名称等。其他控件并不真正需要该顺序或该信息。

如果您希望 Controller 像 FRC 一样监视 ManagedObject 上下文的更改,那么您应该注册 Controller 以获取上下文的各种通知。然后 Controller 可以根据需要更新 View ,就像 FRC 对 TableView 所做的那样。

关于ios - 在 UITableViewController 之外使用 NSFetchedResultsController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5448522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com