使用自定义字体文件创建CCMenuItemLabel

aho*_*ura 2 cocos2d-iphone ios4 ios

我有一个CCMenuitemLabel

  CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:str target:self selector:@selector(startGamefn)];
Run Code Online (Sandbox Code Playgroud)

我想知道如何像在CCLabelBMFont中那样加载字体文件(例如:

CCLabelBMFont *label = [CCLabelBMFont labelWithString:str fntFile:@"good_dog_plain_32.fnt"];
Run Code Online (Sandbox Code Playgroud)

谢谢

Luk*_*man 5

CCMenuItemLabel可以接受CCLabelBMFont,因此您可以label通过函数调用中的对象CCMenuItemLabel:

CCLabelBMFont *label = [CCLabelBMFont labelWithString:str fntFile:@"good_dog_plain_32.fnt"];
CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:label target:self selector:@selector(startGamefn)];
Run Code Online (Sandbox Code Playgroud)