Adding Annotations

Any object can be an annotation in a map view. To become an annotation, the object needs to implement the MKAnnotation protocol. Apple recommends that the annotation objects should be lightweight, since the map view will keep a reference to all the annotations added to it, and map scrolling and zooming performance can suffer if there are too many annotations. If the requirements for the annotation are very simple and basic, an MKPointAnnotation can be used. In the sample app the ICFFavoritePlace class, which implements the MKAnnotation protocol, is a subclass of NSManagedObject so that it can be persisted using Core Data. Refer to Chapter 13, “Getting Up and Running with Core Data,” for more information on using Core Data and ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.