Storing the Settings

In the settings part of the app, the user is able to change the sort order of the displayed contacts. The contacts can be sorted in either ascending or descending order by Name, City, or Birthday (Figure 11.11). Although the user interface for this screen might more logically be set up using Segmented Controls, you will get a chance to work with two new controls, the Picker View and the Switch. The user’s preference for sorting will be stored in a NSUserDefaults object. The data will be stored in the Settings screen and read in the Contacts section of the app.

Image

Figure 11.11 The completed Settings interface.

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.