我无法弄清楚为什么我的标签不按我的指示打印?

时间:2012-08-08 21:36:42

标签: iphone ios label kobold2d

我正在创建一个游戏,在我的“说明”课程中,我创建了一个带有说明的标签

但是,出于某种原因,当我运行游戏时,指令不会打印。 我很难搞清楚原因。

感谢您提供给我的任何帮助!

#import "Instructions.h"
#import "MainMenu.h"

@implementation Instructions

+ (CCScene *) scene
{
    CCScene * scene = [CCScene node]; // scene is an autorelease object
    Instructions * layer =  [Instructions node]; // later is an autorelease object
    [scene addChild: layer]; // add layer as a child to scene
    return scene; // return the scene
}

- (id) init
{
    if ( ( self = [super init] ) )
    {
        [ self how ];
    }
    return self;
}

- (void) how 
{
    // Create the label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"The object of this game is for kangaroo Leo to collect various berries by jumping and running through obstacles in order to unlock other kangaroos and the worlds in which they live." fontName:@"Consolas" fontSize:16];

    // Position it on the screen
    label.position = ccp(160,240);

    // Add it to the scene so it can be displayed
    [self addChild:label z:0];

}
@end

1 个答案:

答案 0 :(得分:0)

在iOS上未预装Consolas。以太网使用Arial之类的默认字体或在项目中放置Consolas.ttf文件。 添加.ttf文件后,转到info.plist并添加一个新行,其中包含应用程序提供的关键字体。在那里添加Consolas.ttf。

有关添加自定义字体的更详细说明,请访问:http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/

或者在stackoverflow上: Can I embed a custom font in an iPhone application?

相关问题