SKSpriteNode setting color with UIColor

2020-04-08 15:23发布

问题:

I would like to set color of SKSpriteNode by Present Components Values of UIColor By Present Components Values of UIColor, I mean:

(UIColor *)blackColor
(UIColor *)blueColor
etc

The problem is that it doesn't work:

SKSpriteNode *noddd = [SKSpriteNode spriteNodeWithColor:blackColor size:CGSizeMake(50, 50);

Is there any possibility to do it?

Thanks in advance ;)

回答1:

Use an SKColor instead of UIColor.

SKSpriteNode *noddd = [SKSpriteNode spriteNodeWithColor:[SKColor blackColor] size:CGSizeMake(50, 50);