Im working with MKMapView and MKAnnotationView.
I have an annotation in the map. When the users tap on it, the callOut Bubble is displayed. When the annotation is tapped again ( and the callOut Bubble is visible ) i need to change to another view.
How can i detect the second tap, or the tap in the bubble?
Here's the swift version of Dhanu's answer, including getting data from the item selected to pass to the next view controller:
Could you add a gesture recognizer when you're initializing the
MKAnnotationView
?Here's the code for inside
dequeueReusableAnnotationViewWithIdentifier:
The method for the gesture recognizer:
To tap the callout button after the user has clicked on the Annotation view, add a UITapGestureRecognizer in didSelectAnnotationView. This way you can implement tap on the callout without needing the accessory views.
You can then get the annotation object back from the sender for further action.
Swift 3, using On. You need to handle
rightCalloutAccessoryView
Try to set custom image for button without changing UIButtonTypeDetailDisclosure type.