Autoshrink on a UILabel with multiple lines

前端 未结 17 2008
醉梦人生
醉梦人生 2020-11-28 21:31

Is it possible to use the autoshrink property in conjunction on multiple lines on a UILabel? for example, the large text size possible on 2 available lines.

17条回答
  •  無奈伤痛
    2020-11-28 22:08

    I found this link http://beckyhansmeyer.com/2015/04/09/autoshrinking-text-in-a-multiline-uilabel/

    The problem can be solved using the Interface Builder in 3 simple steps:

    1. Set “Autoshrink” to “Minimum font size.”
    2. Set the font to your largest desirable font size (20) and set Lines to, say, 10, which in my case was as many lines as would fit in the label at that font size.
    3. Then, change “Line Breaks” from “Word Wrap” to “Truncate Tail.”

    Hope it helps!

提交回复
热议问题