MKAnnotation Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/MapKit.framework |
| Availability | Available in iOS 3.0 and later. |
| Companion guide | |
| Declared in | MKAnnotation.h |
Overview
The MKAnnotation protocol is used to provide annotation-related information to a map view. To use this protocol, you adopt it in any custom objects that store or represent annotation data. Each object then serves as the source of information about a single map annotation and provides critical information, such as the annotation’s location on the map. Annotation objects do not provide the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate MKAnnotationView object to handle the display.
An object that adopts this protocol must implement the coordinate property. The other methods of this protocol are optional.
Properties
coordinate
The center point (specified as a map coordinate) of the annotation. (required) (read-only)
Discussion
Your implementation of this property must be key-value observing (KVO) compliant. For more information on how to implement support for KVO, see Key-Value Observing Programming Guide.
Availability
- Available in iOS 3.0 and later.
Declared In
MKAnnotation.hsubtitle
The string containing the annotation’s subtitle.
Discussion
This string is displayed in the callout for the associated annotation view.
Availability
- Available in iOS 5.0 and later.
Declared In
MKAnnotation.htitle
The string containing the annotation’s title.
Discussion
Although this property is optional, if you support the selection of annotations in your map view, you are expected to provide this property. This string is displayed in the callout for the associated annotation view.
Availability
- Available in iOS 5.0 and later.
Declared In
MKAnnotation.hInstance Methods
setCoordinate:
Sets the new center point of the annotation.
Parameters
- newCoordinate
The new center point for the annotation.
Discussion
Annotations that support dragging should implement this method to update the position of the annotation.
If you implement this method, you must update the value of the coordinate in a key-value observing (KVO) compliant way. For more information on how to implement support for KVO, see Key-Value Observing Programming Guide.
Availability
- Available in iOS 4.0 and later.
Declared In
MKAnnotation.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-10-12)