CCMenuItemFont颜色变化

时间:2012-02-15 23:35:42

标签: objective-c ios5 cocos2d-iphone

如何设置CCMenuItemFont的颜色。我一直在搜索几个小时,返回0个有效结果。他们都过时了。

[CCMenuItemFont setFontName:@"Futura"]; 
    [CCMenuItemFont setFontSize:40];
    CCMenuItem *Play = [CCMenuItemFont itemFromString:@"Play" target:self selector:@selector(goToLevelSelect:)]; 

    CCMenu *menuPlay = [CCMenu menuWithItems: Play, nil]; 
    menuPlay.position = ccp(50,100);
    [menuPlay alignItemsVerticallyWithPadding:10];
    [self addChild:menuPlay]; 

1 个答案:

答案 0 :(得分:6)

CCMenuItemFont派生自CCMenuItemLabel,其标签属性为:

CCMenuItemLabel *play = [CCMenuItemFont itemFromString:@"Play" 
                         target:self selector:@selector(goToLevelSelect:)];
play.color = ccRED;