Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the centre point of MKAnnotation

I am using MKMapkit for map-section in my app. I have to display a pin image enter image description here 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 way to achieve the target. Then please help.

like image 808
iPhoneDv Avatar asked Jan 19 '23 20:01

iPhoneDv


1 Answers

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.

like image 60
Vladimir Avatar answered Jan 25 '23 11:01

Vladimir