当用户点击添加以更改其标题和副标题时,我会将注释的颜色从红色更改为绿色。
我真的迷路了。我搜索了如何制作自定义注释引脚,好的。当用户触摸 pin didSelectAnnotationView
时,我找到了该方法的实现,并且当我点击注释 NSLog(@"Tap") ;
时,它可以工作,但现在我不能更改被触摸的引脚。
非常感谢大家的贡献。
再见
I would change the color from red to green of an annotation when the user pin tapped addition to changing its title and subtitle.
I am truly lost. I searched how to make a custom annotation pin, ok. I found the implementation of the method when the user touches the pin didSelectAnnotationView
and it works when I tap the annotation NSLog(@"Tap") ;
, but now I can not change the pin that was touched.
Thank you very much everyone for your contributions.
Ciao
发布评论
评论(3)
要设置图钉颜色,请使用 MKPinAnnotationView pinColor 属性。
对于自定义注释图像,请设置图像属性。
请注意 MKPinAnnotationView animateDrop 属性不适用于自定义图像。不过,有一种方法可以复制该动画。请参阅如何制作 MKAnnotationView 放置动画?
更新
所以基本上,如果你想在被选中后从红色变为绿色,你就可以这样做。
To set the pin color, make use of MKPinAnnotationView pinColor property.
For custom annotation image, set the image property, as such.
Do note that the MKPinAnnotationView animateDrop property will not work on custom images. There's a way to duplicate that animation though. See How do I animate MKAnnotationView drop?
Update
So bascially, you do this if you wanna change from red to green upon being selected.
在您的方法中,设置
MKAnnotationView
的pinColor
属性,如下所示:In your method set the
pinColor
property of yourMKAnnotationView
as follows:(重新)看看这个:
这是参数中的 MKPinAnnotationView (而不是 MKAnnotationView)
(re) look this :
this is a MKPinAnnotationView (and not MKAnnotationView) in param