Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

9. Migrating and Optimizing with Core Da... > We need to refresh the data

We need to refresh the data

The fugitives aren’t properly changing lists when you change their status because we’re not refreshing the data every time the Captured list view is displayed. We need to set up the NSFetchedResultsController to let us know when things have changed so we can update the table.

Do this!

image with no caption

NSFetchedResultsController can check for changes

Now that we’ve set up the app to work with the NSFetchedResultsController instead of just an array, we can leverage the methods embedded with the controller to help us. The view controller has built-in support for monitoring the data for changes through a delegate. We had set ourselves up as that delegate but never implemented the code to handle data changing.

Having the view completely reload when it detects a change can become cumbersome if you are dealing with a large amount of data; however, the FetchedResultsController delegate also has support built-in for notifying you of the specific cell that is changed, and you can modify just that. Check Apple’s documentation for more details.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial