从给定位置拖动针脚

时间:2013-11-22 12:14:48

标签: ios ios7 xcode5 apple-maps

我正在使用MKMapView来图。在一个视图控制器中,我很长时间在地图中丢弃引脚。现在从预览按钮用户可以看到带引脚的位置。现在我通过点击该按钮有一个按钮,用户可以将针拖动到他们想要的位置。而app可以获得那么长的时间。如何实现这个

1 个答案:

答案 0 :(得分: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);
    }
}