Author Topic: Get UILabel size?  (Read 6238 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Get UILabel size?
« on: August 26, 2012, 01:52:01 AM »
If there a way to get the size of a UILabel's mesh?

I have a UILabel inside a Draggable Panel and I want to find out the size (height) so I adjust its box collider values accordingly to whatever size it is.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Get UILabel size?
« Reply #1 on: August 26, 2012, 05:35:47 AM »
Look for the NGUIMath.CalculateXXXX series of functions (for example NGUIMath.CalculateRelativeWidgetBounds). Just pass a game object whos children you want included in the calculations.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Get UILabel size?
« Reply #2 on: August 26, 2012, 07:28:05 AM »
As ever, cheers for that Arenmook. I will look into later. :)

Shortly after posting I figured out that if I just made the text object as big as the panel window and then made it massive (2000 in Y size) it didn't matter how big or small the object was because the Draggable Panel clips within the objects size automatically and not how big its collider is.