vote up 2 vote down
star

I am little bit confused regarding changing the color of Menu Item.

Because I didn't found any methods regarding it.

I have implemented following in my Game.

	[MenuItemFont setFontName:@"ArialRoundedMTBold"];
	[MenuItemFont setFontSize:30];
	MenuItem *start=[MenuItemFont itemFromString:@"-: Start Game :-" target:self selector:@selector(startGame:)];
	MenuItem *help=[MenuItemFont itemFromString:@"-: Instructions :-" target:self selector:@selector(help:)];
	Menu *menu=[Menu menuWithItems:start,help,nil];
	[menu alignItemsVertically];
	[menu setPosition:CGPointMake(160, 80)];
	[self addChild:menu];

What code should I apply for changing the font color of menu item?

flag
Same for the label. Does any one know how to change the label color? – sagar Oct 2 at 1:07

1 Answer

vote up 1 vote down

Following method is deprecated.

[mnuPause setRGB:

use setColor method.

See, Following Example.


Label color change.

// score title 
	Label *lb=[Label labelWithString:@"SCORE" dimensions:CGSizeMake(320, 18) alignment:UITextAlignmentCenter fontName:@"Helvetica-Bold" fontSize:16];
	[lb setColor:ccc3(255, 215, 41)];
	[lb setPosition:CGPointMake(0,12)];
	[self addChild:lb z:1];


menu color change

// back to main menu
	MenuItem *z=[MenuItemFont itemFromString:@"BACK" target:self selector:@selector(BackToLevels:)];
	Menu *x=[Menu menuWithItems:z,nil];
	[x setColor:ccc3(0, 0, 0)];
	[x setPosition:CGPointMake(115,-9)];
	[self addChild:x z:4];
link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.