Reputation: 3965
When an MKAnnotation is clicked I need to call a function in its view controller, and pass it two NSStrings contained in the annotation. How can I achieve this?
Upvotes: 0
Views: 303
Reputation: 53561
Just assign your view controller as the map view's delegate
and implement
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
MKAnnotationView
has an annotation
property that you can use to get your strings.
Upvotes: 2
Reputation: 3010
Probably the annotations are some kind of buttons? In this case, they are the sender of the action -> A reference to the clicked annotation is passed as argument to the called function!
Upvotes: 0