如何告诉rightCalloutAccessoryView已为MapKit感动 [英] How to tell a rightCalloutAccessoryView has been touched for MapKit
问题描述
我分配了一个MKAnnotationView,并在其右侧显示了DetailDisclosure按钮.我如何知道用户何时单击注释按钮?这就是我的代码现在的样子-
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;
是否有内置方法来检测何时触摸了附件视图?我猜想它就像UITableView方法,但我找不到任何东西.感谢您的帮助.
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.
推荐答案
您需要将一些对象设置为地图视图的delegate
,并实现MKMapViewDelegate
协议方法-mapView:annotationView:calloutAccessoryControlTapped:
.
You need some object to be set as your map view's delegate
, and implement the MKMapViewDelegate
protocol method -mapView:annotationView:calloutAccessoryControlTapped:
.
这篇关于如何告诉rightCalloutAccessoryView已为MapKit感动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!