次のコード スニペットでカスタム イメージを使用するように MKAnnotationView を正常に変更しました。ただし、私の問題は、デフォルトのピンアニメーションを有効にすると
annotationView.animatesDrop = YES;
カスタム イメージはなくなり、デフォルトの赤いピンが使用されます。これを修正する方法はありますか?ありがとう
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(MyAnnotation *)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
// try to dequeue an existing pin view first
static NSString* identifier = @"AnnotationIdentifier";
MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
//!!!!!!!annotationView.animatesDrop = YES;!!!!!!!!!!
} else {
annotationView.annotation = annotation;
}
annotationView.image = [UIImage imageNamed:@"bla.png"];
return annotationView;
}