开发者

Change color of group of MKPinAnnotationView

开发者 https://www.devze.com 2022-12-31 21:52 出处:网络
I have several annotation pins (aprox 700) in a M开发者_C百科apView. Is there any way I can select from an UITableView a row and change the color of a group of pins? Lets say each row representing a g

I have several annotation pins (aprox 700) in a M开发者_C百科apView. Is there any way I can select from an UITableView a row and change the color of a group of pins? Lets say each row representing a group of pins.. Thank you in advance!


You set your pin colours in the MKMapViewDelegate method mapView:viewForAnnotation:. If you use MKPinAnnotationView, you are limited to three colours (red, green purple), which is efficient if you have lots of pins.

If you want, you can return a custom view, possibly a UIImageView, which can be any colour you like.

Setting the values in a tableView: that's up to you. I'd probably pass it in my custom annotation object.

If you want to change an existing view, you could save the views in a NSSet or other collection class as you create them, or you could remove the annotation objects and re-add them to your map.

0

精彩评论

暂无评论...
验证码 换一张
取 消