PDA

View Full Version : Annotations with custom image not being displayed



Conaaando
07.07.2014, 02:39
Hi,

Custom images for annotations are not working on my side.

This is the image I'm using: cl.ly/image/0l0T2n1B3O07

1341

(Photoshop generated, 64x64, 24-bit transparent PNG)

Code (just like the demo project):

SKAnnotation *annotation = [SKAnnotation annotation];
// set unique ID
// set location

annotation.imagePath = [[NSBundle mainBundle] pathForResource:@"purpleAlert" ofType:@"png"];
[self.mapView addAnnotation:annotation];

No luck. Nothing is displayed.

If I chose one of the default types, like:

annotation.annotationType = SKAnnotationTypeStaticSpeedcam3D;

It works fine.

Thanks.

Conaaando
07.07.2014, 02:47
Here is how I solved it:

Outside Xcode, via Terminal:

touch <png file you are trying to use>

Back to Xcode project, clean (command + shift + K).

Install. Enjoy a beer.