I've got pins placed on a map and when I tap on them I'm calling the didSelect
. The function only gets called the first time the pin is tapped, and after that it's not called on that same pin again unless I select another pin and then come back and tap it.
What that sounds like to me is the pin is being selected, and didSelect
can only be called in unselected pins, so when I go tap on another pin it's deselecting the first pin and making it tappable again.
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
view.isSelected = false
}
I don't understand why the above code does not work.
How can I allow my annotations be tapped more than one time in a row?
MKMapView
object calls this method in response to user interactions with the annotation." UsedeselectAnnotation
on the annotation, and let the map view take care of the annotation views itself. – Swoon