iPhoneDv
iPhoneDv

Reputation: 1969

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.

Upvotes: 4

Views: 1377

Answers (1)

Vladimir
Vladimir

Reputation: 170809

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.

Upvotes: 9

Related Questions