How to align UILabel text from bottom?

后端 未结 10 1503
盖世英雄少女心
盖世英雄少女心 2021-02-03 19:08

How the UILabel can be aligned from bottom. Let say, my label can hold three line of text.If the input text is single line, then this line should come bottom of the

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 19:59

    I recently ran into this problem and was able to solve it by putting my label in a stackview by itself. I got the idea from this post which had the same question but with multiple labels. The same technique can be used with a single label.

    The stackview would have axis = horizontal and alignment = bottom (which is what does the trick).

    My label is now perfectly aligned towards the bottom which is what I needed.

提交回复
热议问题