【问题标题】: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)];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-24
      • 1970-01-01
      • 2010-12-03
      • 2019-08-15
      • 1970-01-01
      • 2021-05-19
      相关资源
      最近更新 更多