Swift - Adjusting fontSize to fit the width of the layout (programmatically)

后端 未结 1 2056
春和景丽
春和景丽 2021-02-11 13:19

I\'ve been looking for something to dynamically adjust my fontSize to fit the width of my layout box. But all the answers I can find, is either to use this:

相关标签:
1条回答
  • 2021-02-11 14:16

    Try the following commands for your label:

    label.adjustsFontSizeToFitWidth = true
    label.minimumScaleFactor = 0.2
    

    And try to change the lines of the label to 0 and 1 (check both cases):

    label.numberOfLines = 0 // or 1
    
    0 讨论(0)
提交回复
热议问题