Woo*_*tty 14
肯定的事情伙计(是的,我在跟自己说话),
在您的自定义注释中添加:
@property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate;
Run Code Online (Sandbox Code Playgroud)
这满足了实现setCoordinate的要求,如http://developer.apple.com/iphone/library/documentation/MapKit/Reference/MKAnnotationView_Class/Reference/Reference.html#//apple_ref/occ/instp/MKAnnotationView/draggable中所述.
在MapView委托中添加:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState
{
//..Whatever you want to happen when the dragging starts or stops
}
Run Code Online (Sandbox Code Playgroud)
并在您的AnnotationView集中可拖动为true,例如:
customAnnotationView.draggable = YES;
Run Code Online (Sandbox Code Playgroud)
我认为这就是我为使其发挥作用所做的一切.告诉我你是否有麻烦.