Search code examples
iosskmaps

How do I set a custom image on an map annotation?


I want to set a custom image to a SKAnnotation but when I set the image path the markers wont appear. I set the marker image with the following code:

annotation.imagePath = [[NSBundle mainBundle] pathForResource:@"64-map-test" ofType:@"png"];
annotation.imageSize = 64;

When I use a default image:

annotation.annotationType = SKAnnotationTypeGreen;

the markers do appear correctly.

How do I set a custom image on an map annotation?


Solution

  • png-8 file format is not supported. Using a png-24 file works correctly.