天天看點

iOS開發之-MKAnnotation

MKPointAnnotation (Conforms to MkAnnotation(MKShape))

The MKPointAnnotation class defines a concrete annotation object located at a specified point. You can use this class, rather than define your own, in situations where all you want to do is associate a point on the map with a title.

MKPlacemark 

(Conforms to MKAnnotation)

A MKPlacemark object stores placemark data for a given latitude and longitude. Placemark data includes information such as the country, state, city, and street address associated with the specified coordinate. Placemark objects are typically generated by a MKReverseGeocoder object, although you can also create them explicitly yourself.

A placemark is also an annotation and conforms to theMKAnnotation protocol, whose properties and methods include the placemark coordinate and other information. Because they are annotations, you can add them directly to the map view.

MKUserLocation (Conforms to MKAnnotation)

The MKUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existingMKUserLocation object from the userLocation property of the map view displayed in your application.

MKAnnotation Protocol

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 appropriateMKAnnotationView object to handle the display.