问题
I am having problems to load a image from a .xcassets imageset for a SKSpriteNode.
While it worked fine on iOS 8.x with [SKSpriteNode spriteNodeWithImageNamde:imageName] it doesn't work on some devices on iOS 9. For example it works on iPhone 6/6 Plus and iPad Air but not on the iPod Touch 5G.
Works on all devices with iOS 8.x but not on all devices (for example iPod Touch 5g) on iOS 9.x (Xcode 7, Xcode 7.1 Beta 3):
SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"MenuBackgroundImage"];
background.anchorPoint = CGPointMake(0, 0);
background.zPosition = 100;
[self addChild:background];
The interesting thing is that it works on iOS 9 if I load the image like this:
SKTexture *imageTexture = [SKTexture textureWithImage:[UIImage imageNamed:@"MenuBackgroundImage"]];
SKSpriteNode* background = [SKSpriteNode spriteNodeWithTexture:imageTexture];
The problem is that if I load the image with UIImage that the internal caching won't work. Does anybody know how to load a ImageSet from a .xcassets in iOS 9 correctly so that it works on ALL devices?
来源:https://stackoverflow.com/questions/32987329/ios-9-xcode-7-skspritenode-spritenodewithimagenamed-not-working-on-some-devic