- (void)addAnnotation:(id <MKAnnotation>)annotation;
// If YES and the underlying id<MKAnnotation> responds to setCoordinate:,
// the user will be able to drag this annotation view around the map.
@property (nonatomic, getter=isDraggable) BOOL draggable __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
@interface DraggableAnnotation : MKPlacemark {
}
@property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate;
@end
- (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnnotation>)annotation {
NSString *reuseIdentifier = @"abcdefg";
MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[aMapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier];
if(annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
annotationView.draggable = YES;
annotationView.canShowCallout = YES;
}
[annotationView setAnnotation:annotation];
return annotationView;
}