views:

1737

answers:

1

Need to use own imaged markers instead built-in pins. I have several questions. 1. Is it legally? I have a doubt because there is no standard support for markers(pins) with own icon.

  1. How to make a marker with own icon right way? I found the post which actually describe how-to: http://www.arlingtondev.com/thoughts/?p=81. I am a newbie, but it looks like a "crutch", which i do not want to use in my clean code. Could you advise better way? I had a lot of problems while integrate that method and currenlty cannot move and animate icons, that's why decided to ask stackoverflowers.
+1  A: 

Yes, you can. Check the MKAnnotationView class, it's specifically designed for that. In fact, MKPinAnnotationView inherits from it. Use the image field to specify an image.

Marco Mustapic
Could you say how to change marker's location?
slatvick
If you want to change the latitude/longitude of the marker, change the coordinate of the related `MKAnnotation`. If you want to offset the image, use the `ceterOffset` field of `MKAnnotationView`.The class reference for `MKMapView` explains the relationship between annotations and annotation views.
Marco Mustapic
Yeah it helped. Do you know how to update a marker's location without remove-add this marker to mapview, because it updates its real location only after map moves or zoomed.
slatvick
I think the only way to update an annotation is to remove it and add it again.
Marco Mustapic