Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
18 NSUserDefaults 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're going to 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, and the next time the application is launched, the preferred type of map will be displayed. Open the Whereami project. Then open WhereamiViewController.xib and add a UISegmentedControl to the interface. Change its style and number of segments to what is shown in