Author Topic: UILabel Shrink to Fit width no longer works  (Read 8466 times)

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
UILabel Shrink to Fit width no longer works
« on: September 16, 2013, 10:04:21 AM »
We just updated our NGUI, and I noticed that UILabel now has an option to shrink to fit height. However, the shrink to fit width no longer works. All it does it cut off the text instead of shrinking it. Now only reducing the "Max Height" actually shrinks the text.

Also, I would really like it if the shrinking ignored the new height option if Max Height is set to 0, mainly for backwards compatibility.

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #1 on: September 16, 2013, 04:03:56 PM »
I eagerly await feedback on this from ArenMook, since it's breaking my UI's at the moment.

On a similar topic, how hard would it be to apply line spacing for UILabels ?

tripclaw

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #2 on: September 16, 2013, 04:44:42 PM »
I'm finally upgrading from 2.5x to 2.7.0 - I'm facing similar issues now, I must enter a height for every label even though I only care about width.

But even then a bigger problem for me, after entering a max height,  I notice is the text shrinks towards the top, rather than staying centered even when the text is aligned to center.


Edit: I may just revert back to my old NGUI and wait for 3.00 as it seems to handle shrinking differently, according to what I read here:

http://www.tasharen.com/forum/index.php?topic=5649.msg27178#msg27178
« Last Edit: September 16, 2013, 04:56:38 PM by tripclaw »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #3 on: September 16, 2013, 05:00:19 PM »
Set max lines to 0 if you want the old shrinking behaviour.

Vertical alignment is indeed fixed in 3.0.

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #4 on: September 17, 2013, 07:45:41 AM »
Set max lines to 0 if you want the old shrinking behaviour.

Actually, no, this doesn't work, and wouldn't be a feasible solution anyway. Most of the time when I want to shrink to fit width, I want it only on one or two lines. Setting max lines to 0 implies no line limit, which conflicts with shrinking vs. wrapping.

Please see screenshots.

Gillissie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #5 on: September 17, 2013, 09:45:56 AM »
I now understand that the full answer to this issue is that BOTH the width and height need to be specified WITH 0 FOR MAX LINES, AND the Shrink To Fit checkbox on. If any one of these things isn't true, the whole thing doesn't work. So, I guess I'll just start filling in height values. I noticed that if I use the scale value of the font, it means the height of 1 line.

bloomk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 38
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #6 on: September 18, 2013, 12:26:05 AM »
im having major issues with the label as well.. Seems it always resizes regardless of the values i set for anything.. FAIL!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #7 on: September 18, 2013, 01:53:33 PM »
Happens when you have it set to "resize".

pahe

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 37
    • View Profile
Re: UILabel Shrink to Fit width no longer works
« Reply #8 on: September 19, 2013, 10:24:56 AM »
Vertical alignment is indeed fixed in 3.0.

Any chance to get this in 2.7b maybe? :)