I am searching an answer for adding gesture to the calloutbubble of annotation pin.
I tried different solutions, but they did not work for me.
Here is the latest one:
func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView{
let rightButton = UIButton(type: UIButtonType.detailDisclosure)
let gesture = UITapGestureRecognizer(target: self, action: #selector(callout(gesture:)))
rightButton.addGestureRecognizer(gesture)
view.rightCalloutAccessoryView = rightButton
}
@objc func callout(gesture: UITapGestureRecognizer){
print("tapped")
}