Vertically align text within a UILabel (Note : Using AutoLayout)

前端 未结 17 2674
忘掉有多难
忘掉有多难 2020-12-23 02:24

I am Copying the same Question asked Before Question. I have tried the solutions given and was not able to solve it since sizetofit was not effective when I

17条回答
  •  轮回少年
    2020-12-23 02:42

    If you're not restricted by having UILabel of fixed size, instead of aligning the text within a UILabel, simply use ≥ constraint on the given label to change the size of it.

    It's the most elegant solution using Auto Layout. Don't forget to set numberOfLines to zero though.

提交回复
热议问题