开发者

Any way to call a method only when user clicks on an annotation pin?

I only want to execute a method call when the user clicks on a annotation pin on the map. I read the Apple documentation but am still unsure of how I can do it (or if this is even possible).

For example, I have created a restaurant class with a 'Distance from current location' property and the instances are added to a mapview 开发者_如何学运维as annotations. I only want to trigger the calculateDistance method when the user clicks on an annotation (and the callout view is displayed).

Is there any way of doing this?


Override - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view in your MapView delegate.

The MKAnnotationView contains a property annotation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜