I am trying to create a multiline label in cocos2d 1.0 using CCLabelTTF. I have tried the examples that I have come across, but none seem to work. Here is what I have
CCLabelTTF *storeLabelHeading = [CCLabelTTF labelWithString:@"Here is a really long string that I want to wrap"
dimensions: CGSizeMake(200,0)
alignment: NSTextAlignmentCenter
lineBreakMode: NSLineBreakByWordWrapping
fontName:@"Marker Felt" fontSize: 24];
storeLabelHeading.color = ccc3(0,0,0);
[storeLabelHeading setAnchorPoint:ccp(0,0)];
storeLabelHeading.position = ccp(screenSize.width * 0.35f,
screenSize.height * 0.85);
[self addChild:storeLabelHeading z:kStoreLayer+10];
I have tried a variety of dimensions. If I use CGSizeMake(0,0), then the label will display, but no wrap (which I think is expected). But any other value results in nothing being displayed. What am I doing wrong?
kCCVerticalTextAlignmentCenter
for some reason, when I changed tokCCVerticalTextAlignmentTop
it magically started to work... – Jonny