Max Kortge
Max Kortge

Reputation: 527

Detecting the tap which changes the selected annotation or deselects it

I'm basically trying to detect when an annotation is unselected. So when you either click on another annotation and change the currently selected one or when you tap just on the map and it unselects it.

Upvotes: 0

Views: 406

Answers (1)

Pranav Kasetti
Pranav Kasetti

Reputation: 9915

There is a delegate method for this. Just make sure you set the delegate property of the map view to the containing view controller.

optional func mapView(_ mapView: MKMapView, didDeselect view: 
MKAnnotationView)

This link may help you: https://developer.apple.com/documentation/mapkit/mkmapviewdelegate

Upvotes: 1

Related Questions