문제

How can I set the color of a CCMenuItemFont. I've been searching for hours, returning 0 valid results. They're all outdated.

[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]; 
도움이 되었습니까?

해결책

CCMenuItemFont is derived from CCMenuItemLabel which has a label property:

CCMenuItemLabel *play = [CCMenuItemFont itemFromString:@"Play" 
                         target:self selector:@selector(goToLevelSelect:)];
play.color = ccRED;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top