[iOS 7 Stanford 2013 Fall]Lecture 13 Core Data and Table View

Core Data and UITableView


  • Simply hooks an NSFetchedRequest up to a UITableViewController
  • Usually have an NSFetchedResultsController @property in UITableViewController
  • Use NSFetchedResultsController to answer all UITableViewDataSource protocol’s questions!

Sample Code

Very important method … objectAtIndexPath:

NSFetchedResultsController method…

Create a NSFetchedResultsController

  • Be sure that any cacheName is always associated with exactly the same request.
  • It is critical that the sortDescriptor matches up with the keyPath

NSFetchedResultsController Delegate

NSFRC also watches changes in Core Data and auto-updates table