Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell a rightCalloutAccessoryView has been touched for MapKit

I have a MKAnnotationView being allocated with a DetailDisclosure button being displayed on the right side of the annotation. How would I go about knowing when a user clicked on the annotation button? This is what my code looks like right now -

UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinView.rightCalloutAccessoryView = rightButton;
pinView.animatesDrop = YES;

Is there a built in method to detect when a accessory view has been touched? I'm guessing it would be like the UITableView methods, but I can't find anything. Thanks for any help.

like image 243
Raphael Caixeta Avatar asked Dec 07 '25 06:12

Raphael Caixeta


1 Answers

You need some object to be set as your map view's delegate, and implement the MKMapViewDelegate protocol method -mapView:annotationView:calloutAccessoryControlTapped:.

like image 87
Noah Witherspoon Avatar answered Dec 08 '25 21:12

Noah Witherspoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!