DISPLAYING MAPS AND MONITORING CHANGES USING THE MAP KIT
The iOS SDK ships with the Map Kit framework, a set of libraries that work with the Google Mobile Maps Service. You can use the Map Kit to display maps within your iOS application, as well as to display your current location. In fact, you can enable the Map Kit to track your current location simply by setting a single property, and the Map Kit will then automatically display your current location as you move.
In the following Try It Out, you will get started with the Map Kit. In particular, you will use the Map Kit to display your current location on the map.
TRY IT OUT: Getting Started with Map Kit
- Using Xcode, create a Single View Application (iPhone) project and name it Maps. You also need to use the project name (Maps) as the Class Prefix and ensure that you have the Use Automatic Reference Counting option unchecked.
- Add the MapKit.framework to the Frameworks folder of the project (see Figure 20-1).
- Select the MapsViewController.xib file to edit it in Interface Builder.
- Populate the View window with the following views (see Figure 20-2):
- Map View
- Round Rect Button (label it “Show My Location”; be sure to do this correctly, including capitalization)
- In the MapsViewController.h file, add the following bold ...