Autoshrink on a UILabel with multiple lines

前端 未结 17 2058
醉梦人生
醉梦人生 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:00

    The answer marked as the solution is hacky and imprecise. UILabel will handle it automatically if you set the following properties correctly:

    numberOfLines must be nonzero

    adjustsFontSizeToFitWidth must be YES

    lineBreakMode must not be NSLineBreakByCharWrapping or NSLineBreakByWordWrapping

提交回复
热议问题