Adding annotations to a map view
In Chapter 12, Finishing Up Your User Interface, you added a map view to the Map screen. In previous sections, you added the MapLocations.plist file to your project and created the RestaurantItem and MapDataManager classes. Remember the MVC design pattern? At this point, you have created the views and models for the Map screen, so all you need now is the view controller.
The view controller will be responsible for the following tasks:
- Adding
RestaurantIteminstances, which conform to theMKAnnotationprotocol, to the map view. - For
RestaurantIteminstances within the region displayed in the map view, provideMKAnnotationViewinstances requested by the map view. - Provide custom
MKAnnotationViewinstances which display a callout bubble containing a button when tapped, and present the Restaurant Detail screen when the button is tapped.
You’ll start by creating the MapViewController class as the view controller...