Instance Method

mapView(_:clusterAnnotationForMemberAnnotations:)

Asks the delegate to provide a cluster annotation object for the specified annotations.

Declaration

optional func mapView(_ mapView: MKMapView, clusterAnnotationForMemberAnnotations memberAnnotations: [MKAnnotation]) -> MKClusterAnnotation

Parameters

mapView

The map view containing the specified annotations.

memberAnnotations

The annotations to be clustered together. The returned MKClusterAnnotation object must include the specific annotations in this parameter.

Return Value

The cluster annotation object.

Discussion

Use this method to customize the cluster annotations displayed on your map. Normally, MapKit creates cluster annotation objects automatically when one or more annotations with the same cluster identifier are too close together. However, you can implement this method and return a custom cluster annotation object for the specified set of annotations.

See Also

Managing Annotation Views

func mapView(MKMapView, viewFor: MKAnnotation) -> MKAnnotationView?

Returns the view associated with the specified annotation object.

func mapView(MKMapView, didAdd: [MKAnnotationView])

Tells the delegate that one or more annotation views were added to the map.

func mapView(MKMapView, annotationView: MKAnnotationView, calloutAccessoryControlTapped: UIControl)

Tells the delegate that the user tapped one of the annotation view’s accessory buttons.