0

私はゲームを作成していて、インストラクションクラスで、インストラクションを含むラベルを作成しました

ただし、何らかの理由で、ゲームを実行すると、指示が印刷されません。私はその理由を理解するのに非常に苦労しています。

あなたが私に提供できるどんな助けにも感謝します!

#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
4

1 に答える 1

0

ConsolasはiOSにプリインストールされていません。Etherは、Arialなどのデフォルトのフォントを使用するか、プロジェクトにConsolas.ttfファイルを配置します。.ttfファイルを追加したら、info.plistに移動し、アプリケーションによって提供される主要なフォントを使用して新しい行を追加します。Consolas.ttfも追加します。

カスタムフォントを追加するための詳細な手順については、http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/をご覧ください。

またはここスタックオーバーフローについて: iPhoneアプリケーションにカスタムフォントを埋め込むことはできますか?

于 2012-08-08T22:11:04.793 に答える