An Apple protocol, for model object representing a point on a map view
An object that adopts this MKAnnotation
protocol manages the data that you want to display on the map surface. It does not provide the visual representation displayed by the map. Instead, your map view either registers particular classes for annotations or the delegate provides the MKAnnotationView
objects needed to display the content of your annotations. When you want to display content at a specific point on the map, add an annotation object to the map view. When the annotation’s coordinate is visible on the map, the map view asks its delegate to provide an appropriate view to display any content associated with the annotation.
There is basic MKPointAnnotation
class that is useful if you do not need to add your own custom properties to an annotation.
If you do implement your own object to conform to MKAnnotation
, there are a few considerations:
If you want your map to respond to changes to the
coordinate
,title
, orsubtitle
of the annotation object, make sure to make these conform to KVO (e.g., in Swift, declare them asdynamic
).Probably obvious, but if the annotation views are configured to be draggable, you will want to make the
coordinate
mutable.
See also
MKAnnotation
documentationMKPointAnnotation
documentation