Instance Method

mapView(_:annotationView:calloutAccessoryControlTapped:)

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

Declaration

optional func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl)

Parameters

mapView

The map view containing the specified annotation view.

view

The annotation view whose button was tapped.

control

The control that was tapped.

Discussion

Accessory views contain custom content and are positioned on either side of the annotation title text. If a view you specify is a descendant of the UIControl class, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displayed additional information about the annotation, you could use this method to present a modal panel with that information.

If your custom accessory views are not descendants of the UIControl class, the map view does not call this method.

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, clusterAnnotationForMemberAnnotations: [MKAnnotation]) -> MKClusterAnnotation

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