0

Is there a way to set automatically the font size of a CCLabelTTF text in base of the length of the string? because I have a number that increment and if it gets too big collides with a close image...

swifferina
  • 293
  • 4
  • 16

1 Answers1

1

in cocos2d version 3.x, you can

CCLabelTTF *label = [CCLabelTTF whatever ....];
label.dimensions = CGSizeMake(widthYouWant,heightYouWant);
label.adjustFontSizeToFit = YES;
label.minimumFontSize = 8;

... not tested, just from memory.

YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48