Search code examples
iosobjective-ciphonemkmapviewmkannotationview

In IOS MapView, is there an annotation title call back function or a way to set a target?


I am displaying a custom MKAnnotationView that when clicked displays a title. I know that I can use:

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view;

To detect the click on the annotation view. Once the user clicks on this AnnotationView a title pops up for the annotation. What I want to do is go to a new controller when the title is clicked. So my question is: Is there a way to detect a click on the title?


Solution

  • In your custom MKAnnotationView simply override setSelected:animated: to show a custom view instead of the built-in callout. What's in that view, and what happens when the user taps within it, is now up to you.