开发者

Retain pin coordinates in calloutAccessoryControlTapped action

Can I retain pin coordinates for an calloutA开发者_JAVA百科ccessoryControlTapped action? I want to retain those coordinates to the next view. When you tap a pin, and subsequently go to the next view, i want to use the pin coordinates again. How do I retain those coordinates from that pin?


In the calloutAccessoryControlTapped method, you can access the annotation tapped using view.annotation and the coordinates will be in view.annotation.coordinate.

You can add a property of type CLLocationCoordinate2D to the next view and set it equal to view.annotation.coordinate.


Ask the MKMapView for its selectedAnnotations. As there can only be one, and this will be the one showing a callout, you can take the coordinate in your mapView:annotationView:calloutAccessoryControlTapped: method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜