Search code examples
iosios7mkannotationmkannotationview

Bottom of the custom image for MKAnnotation is not positioned right (size issue)


I have a little problem.
I implemented viewForAnnotation to render custom image for my pin on map.
But it seams that there is something wrong with image.

With standard phone pin icons it works fine but with custom image as you can see bottom of the pin is not where it should be.

Bottom of the pin should be at the end of the red line.
I suppose that there must be some sizing issue.

Can somebody tell me what size should I use when creating custom image for pin?

enter image description here


Solution

  • See centerOffset.

    By default, the center point of an annotation view is placed at the coordinate point of the associated annotation. You can use this property to reposition the annotation view as needed. This x and y offset values are measured in pixels. Positive offset values move the annotation view down and to the right, while negative values move it up and to the left.