Reputation: 3845
I'm working on an app that works properly on my device, but the simulator displays an old version of an image I'm using, and refuses to use the new version. I've deleted the image from Xcode and reimported, I've restarted xcode, I've restarted the simulator, I've removed the file from the build phases and reimported the right version, I've cleaned the project, I've deleted the app from the simulated and rebuilt it, I've tried everything I can imagine, and yet it continues to display the wrong image.
This problem started when I discovered that SpriteKit doesn't use the @2x, so I deleted the smaller image and removed it from the development folder, but the simulator continues to display the smaller image, and the device displays the large one. I renamed the large one without @2x, so it's just the name alone.
Thanks for any help!
Code for displaying the image:
//initialize beginning hand
touchingHand = [SKSpriteNode spriteNodeWithImageNamed:@"Hand"];
touchingHand.position = CGPointMake(self.size.width/2, self.size.height/2);
touchingHand.scale = .17;
[self addChild:touchingHand];
Upvotes: 0
Views: 512
Reputation: 5795
First, sprite kit uses and supports retina images. You need two images - one for lower resolution screens named Hand.png and second - [email protected]. Second needs to be actually two times larger then first image to be displayed correctly.
Are you using correct images for this? Your code is correct, as it uses @2x image automatically. This way you will get same image sizes on retina and non retina devices.
Next - the simulator sometimes fucks stuff up, expecially with texture atlases. Try opening simulator, going to menu on top, Reset Content and Settings.
Upvotes: 1