从Apple文档中读取UITextView,我读了这篇文章的textStorage属性
The text storage object holding the text displayed in this text view. (read-only)
Declaration
OBJECTIVE-C
@property(nonatomic, readonly, strong) NSTextStorage *textStorage
但在我教授的笔记中
[self.body.textStorage
setAttributes:@{NSForegroundColorAttributeName : sender.backgroundColor}
range:self.body.selectedRange];
如果只读取,可以编辑textStorage的属性吗?
答案 0 :(得分:0)
该属性是指向NSTextStorage
对象的指针。 readonly
属性将该属性标记为只读,在这种情况下,它表示无法更改指针。
然而,它没有说明它所指向的对象是否可变。因此,您可以编辑当前的textStorage
,但不能将其替换为其他NSTextStorage
对象。