Chapter 18. The Map Kit framework

 

This chapter covers

  • Adding a map to an application
  • Reverse geocoding
  • Annotating the map

With the Map Kit framework, you can add fully functional and customizable google maps to your application. This framework provides you with a simple view that you can add anywhere you want a map to appear.

In addition to adding the map, you can add custom annotations such as pins to show more information about a specific location. In this chapter we will look at how to add a map to an application first, then use the other functions available in Map Kit to find out the address and put the annotations on the map. Let’s get started!

18.1. Adding a map view to an application

Adding a map view to an application is similar to adding any other view. You can either do it through Interface Builder or programmatically. The choice is up to you, depending on how you like to work with UI elements. We’ll show you both methods.

The view that displays a map is called MKMapView. This class contains quite a bit of functionality including how to display the map, annotations, and user location. We’ll first discuss how to add an MKMapView through Interface Builder. After you add the map to the view, you’ll connect it to an IBOutlet and set its delegate class.

18.1.1. Adding the map using Interface Builder

18.2. Reverse geocoding

18.3. Annotating the map

18.4. Summary