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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

12. A Taste of Core Data > Recipe: Integrating Core Data Table Views with Live ...

Recipe: Integrating Core Data Table Views with Live Data Edits

Recipe 12-3 demonstrates how to move basic table editing tasks into the Core Data world. Its code is based on the basic edits of Recipe 11-4. There are, however, real changes that must be made to provide its Core Data solution. These changes include the following adaptations:

Adding and deleting items are restricted to the data source. Methods that commit an editing style (that is, perform deletes) and that add new cells do not directly address the table view. In the original recipe, each method reloaded the table view data after adds and deletes. Recipe 12-3 saves data to the managed context but does not call reloadData.

Data updates can trigger table reloads. Subscribe to the delegate controllerDidChangeContent: callback. This callback indicates that “fetched results” has updated when data changes have been saved via the managed object context. Use this callback to reload your data and update user options whenever your data changes. This becomes more important as you add undo and redo support, as in Recipe 12-4.


  

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