Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: casimps1 on March 21, 2014, 11:43:25 PM

Title: Finding "actual" size of a UILabel
Post by: casimps1 on March 21, 2014, 11:43:25 PM
I have a UILabel set with a maximum width. I'd like to find out, after assigning text, what the bounds of the actual rendered text is. In other words, if I assign the text "x" to the UILabel, I'd like a small Bounds returned showing how much space the "x" takes up. If I assign the text "hello hello hello" to the UILabel, I'd like a much larger Bounds returned. UILabel.CalculateBounds() seems to just return the maximum bounding box regardless of the UILabel's content.

Is it possible to get the bounds actually used by text in a UILabel?
Title: Re: Finding "actual" size of a UILabel
Post by: ArenMook on March 22, 2014, 02:48:35 PM
label.UpdateNGUIText();
Vector2 size = NGUIText.CalculatePrintedSize(...);