0
我使用this代码将图像添加到MKPointAnnotation。在不更改用户位置图像的情况下将图像添加到MKPointAnnotation
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *SFAnnotationIdentifier = @"SFAnnotationIdentifier";
MKPinAnnotationView *pinView =
(MKPinAnnotationView *)[_routeMap dequeueReusableAnnotationViewWithIdentifier:SFAnnotationIdentifier];
if (!pinView)
{
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:SFAnnotationIdentifier];
UIImage *flagImage = [UIImage imageNamed:@"BikeIconMap"];
// You may need to resize the image here.
annotationView.image = flagImage;
return annotationView;
}
else
{
pinView.annotation = annotation;
}
return pinView;
}
但它也显示用户位置的自定义图像。用户位置的圆形波动画也消失了。
有没有一种方法来添加图片到MKPointAnnotation不改变用户位置的图像和动画?