Instance Method

removeAnnotations:

Removes an array of annotation objects from the map view.

Declaration

- (void)removeAnnotations:(NSArray<id<MKAnnotation>> *)annotations;

Parameters

annotations

The array of annotations to remove. Objects in the array must conform to the MKAnnotation protocol.

Discussion

If any annotation object in the array has an associated annotation view, and if that view has a reuse identifier, this method removes the annotation view and queues it internally for later reuse. You can retrieve queued annotation views (and associate them with new annotations) using the dequeueReusableAnnotationViewWithIdentifier: method.

Removing annotation objects disassociates them from the map view entirely, preventing them from being displayed on the map. Thus, you would typically call this method only when you want to hide or delete the specified annotations.

See Also

Annotating the Map

annotations

The complete list of annotations associated with the receiver.

addAnnotation:

Adds the specified annotation to the map view.

addAnnotations:

Adds an array of annotation objects to the map view.

removeAnnotation:

Removes the specified annotation object from the map view.

viewForAnnotation:

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

annotationsInMapRect:

Returns the annotation objects located in the specified map rectangle.

annotationVisibleRect

The visible rectangle where annotation views are currently being displayed.

dequeueReusableAnnotationViewWithIdentifier:

Returns a reusable annotation view located by its identifier.