简体   繁体   English

在UITableViewController外部使用NSFetchedResultsController

[英]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.

相关问题 UITableViewController和NSFetchedResultsController编辑问题 - UITableViewController and NSFetchedResultsController Editing Issues NSFetchedResultsController不将数据更新到UITableViewController - NSFetchedResultsController not updating data into UITableViewController 如何将NSFetchedResultsController与UITableViewController分离? - How to decouple NSFetchedResultsController from a UITableViewController? 从UITableViewController将NSFetchedResultsController迁移到UIViewController - Migrating NSFetchedResultsController to UIViewController from UITableViewController 在UITableViewController中使用UITextView - 点击外部以关闭键盘 - Using UITextView in UITableViewController - tap outside to dismiss keyboard 使用CoreData在UITableViewController中进行搜索:是否需要第二个NSFetchedResultsController? - Search in a UITableViewController with CoreData: Take a second NSFetchedResultsController? UITableViewController 之外的静态表格视图 - Static table view outside UITableViewController EXC_BAD_ACCESS-NSFetchedResultsController,UITableViewController,UINavigationController,UIPopoverController - EXC_BAD_ACCESS - NSFetchedResultsController, UITableViewController, UINavigationController, UIPopoverController 使用AFIncrementalStore和NSFetchedResultsController的死锁 - Deadlock using AFIncrementalStore and NSFetchedResultsController 使用NSFetchedResultsController的多线程行为 - Multithreading behavior using a NSFetchedResultsController
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM