dialogLabel=[CCLabelTTF labelWithString:@"" dimensions:CGSizeMake(140, 54) hAlignment:UITextAlignmentLeft lineBreakMode:UILineBreakModeWordWrap fontName:@"Marker Felt" fontSize:12];
[dialogLabel setString:@"Hello \n World!"];
But it shows @"Hello \n World!".
If I use
[dialogLabel setString:@"This is a long long long long long long long long long long long long long long long long long sentence!"];
it shows in several lines.
I thought it’s a bug of cocos2d and I tried to find the way to solve this problem on Google, however I didn’t get anything helpful.
I hope you’ll help me with the problem, thanks:)!
According to this source,
CCLabelTTFdoes not (easily?) support this feature, yetCCLabelBMFontdoes.Apparently there is a method involving more code that makes the same work for
CCLabelTTF(link above), so you might want to try that out as well.