i'm facing this problem on iOS(objective-c, not swift). I load a background image from images.xcassets and it displays properly on iOS 8, but not on iOS 7. Have anyone faced this problem before ?
This is the code i'm using:
SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@"xxx"];
background.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
[self addChild:background];
There are also differences in layouts (i'm not using xibs), but the first step is to solve the background :).
Below are the screenshots from ios 7 % ios 8.
Here is a screenshots with images.xcassets:
Thanks,have a great day, Alex.
Seems that ios 7 doesn't recognize that your app is launching in landscape mode so the frame is initialized with the portrait dimensions. I solved this with the following method :
- (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 searching for 'orientation-dependency' in iOS 8. Hope this will be usefull for you too.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments