Contents

removeAnnotations(_:)

Removes an array of annotation objects from the map view.

Declaration

func removeAnnotations(_ annotations: [any MKAnnotation])

Parameters

  • annotations:

    The array of annotations to remove. Objects in the array need to 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 dequeueReusableAnnotationView(withIdentifier:) method.

Removing annotation objects disassociates them from the map view entirely, preventing the map view from displaying them on the map. Typically, you call this method only when you want to hide or delete the specified annotations.

See Also

Annotating the map