This tutorial will show you how to initialize a Label, change its position, change its color, and change what is displayed in the label.
// create and initialize a Label
CCLabel* label = [CCLabel labelWithString:@"Hello World" fontName:@"ShowG.TTF" fontSize:20];
// position the label on the top left of the screen
label.position = ccp( size.width /2 , 250);
//Changes the color of the label
label.color = ccc3(255,150,58);
// add the label as a child to this Layer
[self addChild: label];
//Change the text of the label
[label setString:[NSString stringWithFormat:@"Name: %@, Level: %d, Eggs: %d, Score: %d", name,_level,eggs,_score]];
When you add values to labels, %@ is used for strings, and %d is used for numbers. Remember this our you will get a garbage value. That is how you use labels with cocos2d if you have any questions comment bellow.
Copy right Britney Lee Johnson September 2010.