iPhone MapKit:注释图像重置回引脚 [英] iPhone MapKit: Annotation images get reset back to pins

查看:102
本文介绍了iPhone MapKit:注释图像重置回引脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm adding several annotations to a MapView and using a custom image instead of the default pins. I am using the viewForAnnotation delegate method to set the custom image like this:

view.image = [UIImage imageNamed:@"placemark.png"];

我也试过:

[(MKPinAnnotationView *)view setImage:[UIImage imageNamed:@"placemark.png"]];

现在,这些都将图像设置得很好。但是,当点击注释或 mapType 更改为Satellite或Hybrid时,它会重置为红色图钉。我缺少什么?

Now, these both set the image just fine. But when an annotation is either tapped or the mapType changes to Satellite or Hybrid, it resets back to the red pin image. What am I missing?

推荐答案

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

Don't use MKPinAnnotationView - just use MKAnnotationView.

这篇关于iPhone MapKit:注释图像重置回引脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆