Search code examples
iosiphonesprite-kituicolorskspritenode

SKSpriteNode setting color with UIColor


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 ;)


Solution

  • Use an SKColor instead of UIColor.

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