【问题标题】:create a CCMenuItemLabel with a custom font file使用自定义字体文件创建 CCMenuItemLabel
【发布时间】:2011-10-02 20:07:52
【问题描述】:
我有一个 CCMenuitemLabel
CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:str target:self selector:@selector(startGamefn)];
我想知道如何像在 CCLabelBMFont 中那样加载字体文件(例如:
CCLabelBMFont *label = [CCLabelBMFont labelWithString:str fntFile:@"good_dog_plain_32.fnt"];
谢谢
【问题讨论】:
标签:
ios
ios4
cocos2d-iphone
【解决方案1】:
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)];