chapter ten

Saving and Restoring Data

The Detail Data View, as developed through the end of Chapter 9, “Building the Detail Data View,” provides editable fields for the main data elements of the party (the party name, location, and date), but it stops there. In this chapter, you continue on to save and restore data using both the interface and your data store. You’ll see that there are three related aspects to this task:

Implementing Edit mode—You can use an edit mode in which the fields are editable; when not in edit mode, the data fields are read-only. This is done using a special Edit button. When clicked, it sends you into edit mode, and the button name changes to Done.

Saving the data—The click that changes the Edit button to a Done button not only has to modify the fields to make them editable; it also has to save the data in the database.

Retrieving data—When the view is displayed, you want any data from the database to be shown in the fields.

Figure 10-1 shows the editing interface on iPad; Figure 10-2 shows the interface on iPhone. You will implement them in this chapter. (Note that the default data for a new party name is still a timestamp. You’ll see how to change that in this chapter.)


Figure 10-1 Editing interface on iPad.


Figure 10-2 Editing interface on iPhone. ...

Get iOS 6 Foundations now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.