Reputation: 2366
I would like to emulate the 'Drop Pin' feature in the Maps application. I have a mapview in my controller that I am able to add a MKPlacemark to. It doesn't respond to user action though. Can I emulate the dropped pin with stock classes or do I need to subclass an MKAnnotation View?
EDIT2:
Here's the code I'm trying, which I think should work. It drops the pin, and I can change the color but it can't be moved.
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id
<MKAnnotation>)annotation
{
MKPinAnnotationView *pinView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:nil];
[pinView setDraggable:YES];
[pinView setAnimatesDrop:YES];
[pinView setPinColor:MKPinAnnotationColorGreen];
return pinView;
}
Upvotes: 1
Views: 1577
Reputation: 6539
Here ya go: (iPhone) how to implement draggable pins using OS 4.0 MapKit?
Upvotes: 1
Reputation: 221
With iOS 4 it's natively possible. Did you add an custom annotationView or a MKPinAnnotationView?
Look a the "draggable" property in MKAnnotationView.
Upvotes: 1