19Settings

Many applications include preferences that users can set. Whether users are picking the size of the text or storing usernames, there is a standard way of enabling iOS application preferences. In this chapter, you will use the NSUserDefaults class to add a preference to your Whereami application. This preference will specify the map type of the MKMapView.

Updating Whereami

Every MKMapView has a mapType property that specifies whether it shows roads, satellite imagery, or both. You will allow the user to change this property by adding a UISegmentedControl that toggles the map type. The user’s choice will be saved as a preference for the next time the application is launched.

Open the Whereami project. Then open MainWindow.xib and add ...

Get iOS Programming: The Big Nerd Ranch Guide, Second Edition 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.