Multiline label in UIStackView

后端 未结 21 2840
有刺的猬
有刺的猬 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条回答
  •  -上瘾入骨i
    2020-12-02 05:12

    26 November 2020, Xcode 12.2, iOS 14.2. Following works for me for vertical stack view. It works on all devices and simulators. I use storyboard and all these values are set in storyboard.

    UILabel

    Lines: 0

    UIStackView

    Alignment: Fill

    Distribution: Fill Proportionally

    UILabel is embedded in a view and pinned to all sides to UIView.

提交回复
热议问题