How to set MKPinAnnotation so that bottom of image points to location instead of center of image

StackOverflow https://stackoverflow.com/questions/18301608

Вопрос

How can I move the pin image so that the bottom of the image points to the location (like the default pin). Currently the center of the image points to that location (San Francisco).

enter image description here

Это было полезно?

Решение

You'll need to calculate the number of pixels to offset and then set the centerOffset property.

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top