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

和自甴很熟 提交于 2019-12-14 03:12:32

问题


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).


回答1:


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.



来源:https://stackoverflow.com/questions/18301608/how-to-set-mkpinannotation-so-that-bottom-of-image-points-to-location-instead-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!