AutoLayout + RTL + UILabel text alignment

前端 未结 9 1053
面向向阳花
面向向阳花 2020-11-28 11:18

I\'m finally getting round to wrestling with Auto Layout and can\'t seem to figure out how to get right-to-left (RTL) support to work the way I\'d expect/want...

I h

9条回答
  •  渐次进展
    2020-11-28 11:55

    I think you don't want to use text alignment in this case, for a label.

    You can just let the width be determined by intrinsicContentSize, and remove any width constraints on the label. You will achieve the desired effect of the label text aligned to the view.

    For x axis, you only need this constraint between label and imageview: [imageview]-[label]

    This is only a horizontal spacing constraint. No leading or trailing to superview.

提交回复
热议问题