Instance Method

registerClass:forAnnotationViewWithReuseIdentifier:

Registers an annotation view class that the map can create automatically.

Declaration

- (void)registerClass:(Class)viewClass forAnnotationViewWithReuseIdentifier:(NSString *)identifier;

Parameters

viewClass

The class of an annotation view that you use in your map. The class must be a subclass of MKAnnotationView.

identifier

The reuse identifier to associate with the specified class. This parameter must not be nil or an empty string.

Discussion

Use this method to register one or more views that you use to display annotations on your map. Register your classes before adding any annotations to the map.

When you register an annotation view class using this method, the dequeueReusableAnnotationViewWithIdentifier:forAnnotation: method uses the provided identifier to create the view that you registered. It creates a new view only if an existing view is not available for reuse.

See Also

Creating Annotation Views

- dequeueReusableAnnotationViewWithIdentifier:forAnnotation:

Returns a reusable annotation view using the specified identifier.

- dequeueReusableAnnotationViewWithIdentifier:

Returns a reusable annotation view located by its identifier.

- viewForAnnotation:

Returns the annotation view associated with the specified annotation object, if any.

MKMapViewDefaultAnnotationViewReuseIdentifier

The default reuse identifier for your map's annotation views.

MKMapViewDefaultClusterAnnotationViewReuseIdentifier

The default reuse identifier for the annotation view representing a cluster of annotations.