Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Thurinus on October 31, 2013, 04:26:48 PM

Title: [Irrelevant] How do I make a background sprite hug a UILabel?
Post by: Thurinus on October 31, 2013, 04:26:48 PM
Using NGUI 2.5.0c

Hi all,

I'm trying to get a background sprite to hug a UILabel that can have a variable width up to a certain max width. I've been referencing the UITooltip code that resizes the background to the UILabel. The problem with this approach is that if I have a UILabel with a lineWidth set, the background will always enclose the full lineWidth regardless of the amount of text in the UILabel. Is there a way to make the background shrink to the text if the text takes up less space than the full line width?

Thanks!
Title: Re: How do I make a background sprite hug a UILabel?
Post by: ArenMook on November 01, 2013, 08:16:45 AM
http://www.tasharen.com/forum/index.php?topic=6328.0
Title: Re: How do I make a background sprite hug a UILabel?
Post by: Thurinus on November 01, 2013, 07:53:33 PM
I failed to mention that circumstances beyond my control make upgrading practically impossible (team decided it was a great idea to add some custom modifications to the libraries). Regardless, sorry for wasting your time.
Title: Re: [Irrelevant] How do I make a background sprite hug a UILabel?
Post by: ArenMook on November 01, 2013, 08:18:56 PM
Pro version of NGUI would allow you to keep your modifications and still remain up to date. One of many advantages of having access to the original source code repository.
Title: Re: [Irrelevant] How do I make a background sprite hug a UILabel?
Post by: Nicki on November 02, 2013, 02:58:20 PM
Anchor it to the label.

Also, you can upgrade with custom changes, if you're careful and use your versioning diffs.