以编程方式更改NSTextView的文本
问题描述:
我找不到任何似乎与 NSTextView
中显示的文本值相关的参数。我理解一个 NSTextView
使用一个复杂的结构( NSLayoutManager
等...),但我找不到修改当前文本
值的有效方法。
I can't find any parameter that seems to be related with the text value showed in a NSTextView
. I understood that a NSTextView
uses a complex structure (with NSLayoutManager
etc...), but I can't find a valid way to modify the current text
value.
答
方法是setString [textView setString:@string];
The right method is "setString" [textView setString:@"the string"];