In IOS MapView, is there an annotation title call back function or a way to set a target?

这一生的挚爱 提交于 2019-12-02 15:55:58

问题


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;

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?


回答1:


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.



来源:https://stackoverflow.com/questions/26417110/in-ios-mapview-is-there-an-annotation-title-call-back-function-or-a-way-to-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!