Does anyone have any idea why images used for a MKPinAnnotationView should be offset slightly (up and to the right) the code I am using is:
pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pinView_ID];
pinView.image = [UIImage imageNamed: @"TEST_Small.png"];
// RedCircleImage = 40px x 40px 72dpi PNG
// GreenDotImage = 2px x 2px 72dpi PNG
There are no changes to the code just a change in the filename for the image used, one image is the "the two red rings with a black dot in the center" the other is the "small green dot" I have added the thin blue lines in Photoshop to help show where the green dot is.
I have checked the centerOffset property and its correctly set to 0,0
Any ideas would be welcome.
As Dolbz has pointed out, you should use MKAnnotationView
instead of MKPinAnnotationView
. When you set the image, you can also set a centerOffset
that is appropriate for your image. The default centerOffset
should work for your images, but if you would display a pin, flag, etc. you would set it differently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With