Giving an NSTextView some padding/a margin

前端 未结 4 2024
无人共我
无人共我 2021-02-02 00:08

How would I give a NSTextView some padding/a margin to the left? I know how you do it in a NSTextField (by subclassing NSTextFieldCell) but how do you do it in a NSTextView?

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 01:04

    The way TextEdit does it (when in Wrap to Page mode) is to put the text view inside of a larger view, and set that larger view as the document view of the scroll view. That's more work to set up, but won't leak presentation information (in the form of a specially-customized paragraph style) into the model (the text).

提交回复
热议问题