在IOS MapView中,是否有注释标题回调函数或设置目标的方法? [英] In IOS MapView, is there an annotation title call back function or a way to set a target?

查看:64
本文介绍了在IOS MapView中,是否有注释标题回调函数或设置目标的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在显示一个自定义的MKAnnotationView,当点击它时会显示标题。我知道我可以使用:

I am displaying a custom MKAnnotationView that when clicked displays a title. I know that I can use:

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view;

检测注释视图上的点击。一旦用户点击此AnnotationView,就会弹出标题。我想要做的是在点击标题时转到新的控制器。所以我的问题是:有没有办法检测标题上的点击?

To detect the click on the annotation view. Once the user clicks on this AnnotationView a title pops up for the annotation. What I want to do is go to a new controller when the title is clicked. So my question is: Is there a way to detect a click on the title?

推荐答案

在自定义MKAnnotationView中只需覆盖 setSelected:animated:显示自定义视图而不是内置标注。这个视图中的内容,以及当用户点击它时会发生什么,现在取决于你。

In your custom MKAnnotationView simply override setSelected:animated: to show a custom view instead of the built-in callout. What's in that view, and what happens when the user taps within it, is now up to you.

这篇关于在IOS MapView中,是否有注释标题回调函数或设置目标的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆