Support => NGUI 3 Support => Topic started by: Aurigan on August 17, 2017, 11:06:54 AM
Title: UILabel Resize Freely truncates content
Post by: Aurigan on August 17, 2017, 11:06:54 AM
A UILabel with 'resize freely' overflow option AND a 'max width' set will truncate content after that max width is hit.
What would be the easiest way to change UILabel 'resize freely' overflow behavior to shrink content once that max width was hit?
Title: Re: UILabel Resize Freely truncates content
Post by: ArenMook on August 21, 2017, 06:28:33 PM
Turn off resize freely, change it to shrink content -- and set the label's width/height to what it should be.
Title: Re: UILabel Resize Freely truncates content
Post by: Aurigan on August 24, 2017, 04:21:11 AM
Hi Aren, thanks for the reply ... the issue is that I need the resize freely behavior - I want to have a label centered but with an icon anchored to the labels right. I guess the alternative hack would be to calc the content width and adjust the icon position in code but would prefer to have a code-free solution to something this standard!
What would your recommendation be for taking this on?
Title: Re: UILabel Resize Freely truncates content
Post by: ArenMook on August 25, 2017, 12:43:54 AM
You can simply set the label's pivot point to the right side, then any child you add to that label will be automatically relative to that side, no anchoring needed.
Edit: I think I see what you're asking. Lemme think about it.
Title: Re: UILabel Resize Freely truncates content
Post by: ArenMook on August 25, 2017, 01:02:55 AM
Turns out this is easier than I thought. Go to UILabel, around line ~1400-1430