Within following method of MKMapViewDelegate
:
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "")
pinAnnotationView.rightCalloutAccessoryView = UIButton(type: .DetailDisclosure)
pinAnnotationView.canShowCallout = true
return pinAnnotationView
}
If I do it like above, then a whole view is tappable:
otherwise:
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "")
let accessoryView = UIButton(frame: CGRectMake(0, 0, 25, 25))
accessoryView.setImage(UIImage(named: "icon-menu"), forState: .Normal)
pinAnnotationView.rightCalloutAccessoryView = accessoryView
pinAnnotationView.canShowCallout = false
return pinAnnotationView
}
only right accessory view is tapped, why?
The question is. What to do to make tappable a whole
MKPinAnnotationView
not just its right disclosure?