Support => NGUI 3 Support => Topic started by: Quel on June 18, 2015, 03:09:55 AM
Title: Properly set the UILabel width.
Post by: Quel on June 18, 2015, 03:09:55 AM
Hi. I have "elementary" problem here that I can't fix.
- I use a box(UISprite) with a variable width. - Into the box there are a variable text(UILabel). - The text it's horizontally anchored to box, so it supposed to it should adjust to available box width. - I set new width to the box. - I set new text value to de Label. - Text anchoring method don't notice correctly the box size, so it does wrong. - So when I try to read the text height, it returns a bad value.
How can I solve it ?.
PD: I have already try it using ALL possible methods into UILabel/UISprite class: UpdateAnchors, ResetAndUpdateAnchors, CalculateBounds, ProssesText, UpdateNGUIText, MarkAsChanged, Update, ...
Title: Re: Properly set the UILabel width.
Post by: Quel on June 18, 2015, 04:58:07 AM
At last. After testing a lot of random combinations of methods, I found one that "works".
myLabel.text="bla bla bla bla bla bla bla bla bla bla bla";