开发者

How to change the centre point of MKAnnotation

开发者 https://www.devze.com 2023-04-01 19:38 出处:网络
I am using MKMapkit for map-section in my app. I have to display a pin imageas MKAnnotation. When I add the annotation in map view, the center of the image, points to the latitude and longitude. But I

I am using MKMapkit for map-section in my app. I have to display a pin image

How to change the centre point of MKAnnotation

as MKAnnotation. When I add the annotation in map view, the center of the image, points to the latitude and longitude. But I want that the bottom-left corner of the image should point to the specified latitude and longitude. I am following the link MapCallouts for displaying the annotation. Is there any wa开发者_Python百科y to achieve the target. Then please help.


You need to set appropriate value to centerOffset property of annotation view:

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.

0

精彩评论

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