1

I'm having a little bit of trouble with an image I need for my SpriteKit project. I'm creating a background for my game. This is the code I have in my scene:

let backgroundName = "Background" //this is temporary

let backgroundImage = SKSpriteNode(imageNamed: backgroundName)
backgroundImage.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame))

self.addChild(backgroundImage)

I think there's no problem there. This is my asset catalog: Asset catalog

I don't think there's a problem there, either. But that doesn't work. When running the app on my iPad, all I get is a black background. The interesting thing is that if I put the assets in a "Universal" group, instead of the "iPad" group, the background will show correctly. Why? This is something I don't want to do, since I want to add assets for the iPhone.

Any help would be appreciated. Thanks.

Amani Elsaed
  • 1,558
  • 2
  • 21
  • 36
José María
  • 2,835
  • 5
  • 27
  • 42

0 Answers0