Have you ever wanted to insert a new line character or set the appropriate height for some font size when you know the width to wrap text on a CCLabel in Cocos2d?
Here is a quick snippet on how to wrap your text in a CCLabel in both cases:
NSString *text = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas non mi ante. Etiam dignissim sodales nibh, et posuere leo rutrum sed. Suspendisse nisl lectus, convallis at eleifend eget, molestie eu nunc.";
// self.contentSize.width is limiting the width of the label to this CCNode,
// in my case it's a new layer of a specific width and height and i don't
// want the text to go outside these demensions.
CGSize textSize = [text sizeWithFont:[UIFont fontWithName:@"Helvetica" size:18.0f]
constrainedToSize:CGSizeMake(self.contentSize.width, CGFLOAT_MAX)
lineBreakMode:UILineBreakModeWordWrap];
CCLabel *textLabel = [CCLabel labelWithString:text
dimensions:textSize
alignment:UITextAlignmentCenter
fontName:@"Helvetica"
fontSize:18.0f];