Multiline label in UIStackView

后端 未结 21 2909
有刺的猬
有刺的猬 2020-12-02 04:30

When putting multiline label (with linebreak set to Word Wrap) into a stack view, the label immediately loses the linebreak and displays the label text in one line instead.<

21条回答
  •  心在旅途
    2020-12-02 05:32

    • First set the label number of lines to 0
    • The stack view still won't grow to multiLine unless you give it a fixed width. When we fix its width then it break to multiline when that width is reached as shown:

    If we don't give a fixed width to the stack view then things get ambiguous. How long will the stack view grow with the label (if the label value is dynamic)?

    Hope this can fix your issue.

提交回复
热议问题