I am unable to figure out why my label isn't printing for my instructions?

109 Views Asked by At

I am creating a game and in my Instructions class I have created a label with the instructions

However, for some reason, when I run my game the instructions do not print. I am having a very hard time figuring out why.

Thank you for any help you can provide me!

#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

There are 1 best solutions below

0
On BEST ANSWER

Consolas is not pre installed on iOS. Ether use a default font like Arial or put a Consolas.ttf file in your project. After you added your .ttf file go to your info.plist and add a new row with the key Fonts provided by application. Add there Consolas.ttf too.

For a more detailed instruction to add a custom font visit: http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/

or here on stackoverflow: Can I embed a custom font in an iPhone application?