如何判断 MapKit 的 rightCalloutAccessoryView 已被触摸

发布于 2024-08-28 10:20:12 字数 348 浏览 4 评论 0原文

我分配了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哑剧 2024-09-04 10:20:12

您需要将某个对象设置为地图视图的委托,并实现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:.

盗琴音 2024-09-04 10:20:12

在 MKMapViewDelegate 中实现 mapView:annotationView:calloutAccessoryControlTapped: 方法。

Implement mapView:annotationView:calloutAccessoryControlTapped: method in your MKMapViewDelegate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文