[英]Using NSFetchedResultsController outside of a UITableViewController
因为非UITableView控制器将无法实现NSFetchedResultsControllerDelegate
协议,所以在UITableViewController
之外使用NSFetchedResultsController
是否会出错?
There is no particular reason you can't use a NSFetchedResults controller without a table. 没有没有表的情况就无法使用NSFetchedResults控制器的特殊原因。 You can define any arbitrary class to implement the NSFetchedResultsControllerDelegate protocol.
您可以定义任何任意类来实现NSFetchedResultsControllerDelegate协议。
However, there is seldom any particular reason why you would want to do so. 但是,您几乎没有任何特定原因要这样做。 The FRC is designed to fetch and order data for a table.
FRC旨在获取和排序表的数据。 It tracks section names and the like as well.
它也跟踪节名称等。 Other controls don't really need that ordering or that information.
其他控件实际上并不需要该顺序或信息。
If you want a controller to watch the managedObject context for changes like an FRC, then you should register the controller for context's various notifications. 如果您想让控制器监视诸如FRC之类的ManagedObject上下文的更改,则应为该控制器注册上下文的各种通知。 Then the controller can update the view as needed just as an FRC does for a tableview.
然后,控制器可以根据需要更新视图,就像FRC对表视图所做的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.