Word-wrapping Labels

Word-wrapping Labels
0.0 0


So I have been fleshing out CS and so far so good, one question do I have to manually word-wrap my labels or is there a way to do that from within the UI Editor?

thank you.


I found no way of doing it inside the editor. But maybe someone kwons how to.
In code, I use the char ‘’ to add a new line.


Maybe you can extend the UITextfield class and add this word-wrap feature in it.
Cocos2d-x doesn’t support a auto word wrap widget now


ok thanks guys, I will work something out.


I get an strange behaviour with wrapping on last CocoStudio’s UILabel.
On Win32 and Android, if I set a long string to a UILabel, the full message is printed with word-wapping on spaces, so everything can be read fine.

      Label *message = dynamic_cast<Label*>( UIHelper::seekWidgetByName(root, "Message") );
      if (message != NULL)
         message->setText( longString );
      message->setFontName( FONT_TTF_NAME );
      message->setFontSize( 32 );

BUT, on MacOS the text wraps in the middle of words.
Also, on MacOS, sometimes it seems that font texture is not generated correctly, and the text appears distorted, like if it was streched (no scaling done, just a simple call to setText() ).
I 'm not able to try on iOS yet, but it happends on MacOS builds (32 or 64 bits).
Any idea why?


Changing the text area size works for me, on 3.6.

label->setTextAreaSize(Size(100, 100));


Actually, that’s only with ui::Text, not Label. Couldn’t figure this out for standard BMFont labels.