我正在使用 MKMapView 来回地图。在一个视图控制器中,我在地图中放置大头针的时间越来越长。现在,从预览按钮用户可以看到带有 pin 的位置。现在我有一个按钮,通过单击该按钮,用户可以将图钉拖动到他们想要的位置。应用程序可以得到那么长的时间。如何实现这一点
问问题
453 次
1 回答
2
使用此代码并采用MKMapViewDelegate
- (void)mapView:(MKMapView *)mapView
annotationView:(MKAnnotationView *)annotationView
didChangeDragState:(MKAnnotationViewDragState)newState
fromOldState:(MKAnnotationViewDragState)oldState
{
if (newState == MKAnnotationViewDragStateEnding)
{
CLLocationCoordinate2D droppedAt = annotationView.annotation.coordinate;
NSLog(@"Pin dropped at %f,%f", droppedAt.latitude, droppedAt.longitude);
}
}
于 2013-11-22T12:20:57.633 回答