如何长按移动MKAnnotationView

我在MKMapKit中放了一个大头针(MKAnnotationView)
现在如何长按移动MKAnnotationView,并把它放到别的位置?
谢谢~

阅读 5.4k
1 个回答

实现这个方法

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view didChangeDragState:(MKAnnotationViewDragState)newState 
   fromOldState:(MKAnnotationViewDragState)oldState

我以前项目更新地址是这么实现的:
自定义一个YourAnnotation:MKAnnotation,继承自MKAnnotation。
在上述api中得到(YourAnnotation *)ann = [view annotation];
使用ann的lat lon值通过google api获取详细地址。

https://github.com/qdvictory/TellLoca... 这个比较全面,只是google今天不好使。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进