1

each answer, I've found to the topic about says that I just need to add a UIButtonType.DetailDisclosure button to the right, and then this method would be notified:

func mapView(mapView: MKMapView!, annotationView: MKAnnotationView, calloutAccessoryControlTapped control: UIControl)

This method would be notified no matter if I click on the button or on the callout itself. Well in my case, the method will be notified if I click on the button, but not if I click on the callout.

This is the code I use to add a button. As you can see I've added a custom image, but this doesn't matter. It also won't work with a plain button.

     let rightImage = UIImage(named: "rightIcon")
     let rightButton   = UIButton.buttonWithType(UIButtonType.DetailDisclosure) as UIButton
     rightButton.setImage(rightImage, forState: UIControlState.Normal)
     rightButton.frame = CGRectMake(0, 0, 16, 16)
     pinView!.rightCalloutAccessoryView = rightButton
Christian
  • 6,961
  • 10
  • 54
  • 82

0 Answers0