Reputation: 613
I am attempting to use a pattern as a background color for an SKScene:
override func didMoveToView(view: SKView) {
let backgroundImage: UIImage = UIImage(named: "BackgroundSquare.png")!
// print(backgroundImage)
self.backgroundColor = UIColor(patternImage: backgroundImage)
}
... but the background always comes out black. I have attempted with the "BackgroundSquare.png as a white square and also with a transparent background but with no luck. I know that backgroundImage
is not nil (which is why I have the print()
line.
Am I using UIColor(patternImage:)
incorrectly?
Upvotes: 0
Views: 170
Reputation: 84
SKScene does not support pattern images. You can do something similar using a shader, but you won't be able to use that API with any effect. Why there's no warning? No idea.
Upvotes: 1