如何判断 MapKit 的 rightCalloutAccessoryView 已被触摸
我分配了一个 MKAnnotationView,并在注释的右侧显示了一个 DetailDisclosure 按钮。我如何知道用户何时单击注释按钮?这就是我的代码现在的样子 -
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinView.rightCalloutAccessoryView = rightButton;
pinView.animatesDrop = YES;
是否有内置方法来检测辅助视图何时被触摸?我猜它会像 UITableView 方法一样,但我找不到任何东西。感谢您的任何帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将某个对象设置为地图视图的
委托
,并实现MKMapViewDelegate
协议方法-mapView:annotationView:calloutAccessoryControlTapped:
。You need some object to be set as your map view's
delegate
, and implement theMKMapViewDelegate
protocol method-mapView:annotationView:calloutAccessoryControlTapped:
.在 MKMapViewDelegate 中实现
mapView:annotationView:calloutAccessoryControlTapped:
方法。Implement
mapView:annotationView:calloutAccessoryControlTapped:
method in your MKMapViewDelegate.