Difference between iOS 7 and ios 8 iOS spriteNode background images
I faced this problem on iOS (objective-c, not fast). I load a background image from images.xcassets and it displays correctly on iOS 8 but not iOS 7. Has anyone encountered this issue before?
This is the code I am using:
SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"xxx"];
background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
[self addChild:background];
There are also layout differences (I'm not using xibs), but the first step is to resolve the background :).
Below are screenshots from ios 7% ios 8.
Here are screenshots with images. xcassets:
Thanks, had a great day, Alex.
+3
source to share
1 answer
It seems that ios 7 doesn't recognize that your app is launching in landscape mode, so the frame is initialized with the portrait parameters. I solved it in the following way:
- (CGSize)screenSize {
CGSize screenSize = [UIScreen mainScreen].bounds.size;
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
return CGSizeMake(screenSize.height, screenSize.width);
}
return screenSize;
}
You can find out more by looking for the "orientation dependency" in iOS 8. Hopefully this will be helpful to you too.
0
source to share