I’m working on universal game (iPhone and iPad) with SpriteKit and I have issue with background size. I created image size 2048x1536 and more image for iPhone devices in size 1136x852 and still the background is cropped on iPhone. How can I fix it?
let screenHeight = screenSize.size.height
//Backgorund
var dayBackground = SKSpriteNode(imageNamed:"BackgroundDay")
dayBackground.zPosition = -1
dayBackground.position = CGPoint(x:size.width/2, y:size.height/2)
dayBackground.anchorPoint = CGPointMake(0.5, 0.5)
dayBackground.size = self.frame.size
GameViewController:
if let scene = GameScene(fileNamed:"GameScene") {
// Configure the view.
let skView = self.view as! SKView
skView.showsFPS = true
skView.showsNodeCount = true
/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill
skView.presentScene(scene)
}
iPhone 6 Plus: