Adding annotations to a map view
In Chapter 11, Finishing Up Your User Interface, you added a map view to the Map screen. In the previous sections, you added MapLocations.plist
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
RestaurantItem
instances, which conform to theMKAnnotation
protocol, to the map view. - For
RestaurantItem
instances within the region displayed in the map view, it will provideMKAnnotationView
instances requested by the map view. - Providing custom
MKAnnotationView
instances that display a callout bubble containing a button when tapped, and then presenting the Restaurant Detail screen when the button is tapped.
You'll start by creating the MapViewController
class as the view controller for...