iPhone MapKit:注释图像重置回引脚

Kev*_*upp 4 iphone mapkit mkpinannotationview mkmapview

我正在向MapView添加几个注释并使用自定义图像而不是默认图钉.我正在使用viewForAnnotation委托方法来设置自定义图像,如下所示:

view.image = [UIImage imageNamed:@"placemark.png"];
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

[(MKPinAnnotationView *)view setImage:[UIImage imageNamed:@"placemark.png"]];
Run Code Online (Sandbox Code Playgroud)

现在,这些都将图像设置得很好.但是,当点击注释或mapType更改为卫星或混合时,它会重置为红色图钉.我错过了什么?

Bil*_*ill 18

不要使用MKPinAnnotationView - 只需使用MKAnnotationView.