Using NSFetchedResultsController outside of a UITableViewController
Would it be wrong to use NSFetchedResultsController
outside of a UITableViewC开发者_Go百科ontroller
, since non-UITableView controllers would be unable to implement the NSFetchedResultsControllerDelegate
protocol?
There is no particular reason you can't use a NSFetchedResults controller without a table. You can define any arbitrary class to implement the NSFetchedResultsControllerDelegate protocol.
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. 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. Then the controller can update the view as needed just as an FRC does for a tableview.
精彩评论