I have this code to delete and add a new pin in my map:
- (IBAction)setLocation:(id)sender{
NSMutableArray *toRemove = [NSMutableArray arrayWithCapacity:1];
for (id annotation in map.annotations)
if (annotation != map.userLocation)
[toRemove addObject:annotation];
[map removeAnnotations:toRemove];
MKPointAnnotation *annotationPoint = [[[MKPointAnnotation alloc] init]autorelease];
annotationPoint.coordinate = map.userLocation.coordinate;
annotationPoint.title = @"Position";
[map addAnnotation:annotationPoint];
MKPinAnnotationView *pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotationPoint reuseIdentifier:@"Pin"] autorelease];
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
//pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinView.animatesDrop = TRUE;
}
but I set my pin it don’t do animation but I set animatesDrop = true, why?
I think that this might help. I believe you might try using the MKMapViewDelegate (Apple Documentation, check the MapCallouts sample project) method:
Make sure to add the
<MKMapViewDelegate>protocol in the header