I am currently using Cocos2d FrameWork for my Game. I need to change the background color in a CCLabelTTF.I know how to set font color, can someone please tell me how to change background color of the CCLabelTTF object.
CCLabelTTF *nameLabel=[CCLabelTTF labelWithString:[NSString stringWithFormat:@"%@",[plyName objectAtIndex:i]] fontName:@"Arial" fontSize:20];
nameLabel.position=ccp(100,y1);
nameLabel.color=ccc3(245, 222, 179);
[self addChild:nameLabel];
This is my sample code for adding Label. Any ideas?
You can not set the background color of a CCLabelTTF.
What you can do is to display a single color CCSprite behind the label, or use CCLayerColor in the background with the same width and height of the label.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With