Multi-line NSTextField not working

前端 未结 2 833
感情败类
感情败类 2021-01-13 03:10

I have been trying to get a multi-line NSTextField to lay out automatically using preferredMaxLayoutWidth. I can’t figure out why this doesn’t work

2条回答
  •  误落风尘
    2021-01-13 03:53

    There is an another solution for making the NSTextField multiline with using auto constraints and Interface Builder.

    • Choose Wraps from Layout
    • Choose Character Wrap from Line Break option
    • Uses Single Line Mode must be unchecked

    And add below sample constraints

    • Trailing Space
    • Leading Space
    • Bottom Space
    • Top Space

    with the constants that you want. And don't add any specific height constraint.

    Below some screenshots which might be helpful.

提交回复
热议问题