我使用 Cocoa 的第二天。我已经设置了一个 NSTextView,它的属性字符串绑定(bind)到一个 NSArrayController(我正在使用核心数据):
controller key: selection
model key path: myString
我读到 NSTextView 需要 NSAttributedString,这就是它在尝试设置属性值时抛出异常的原因。
NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "myString"; desired type = NSString; given type = NSConcreteAttributedString;
有什么想法可以让我的 managedObject 的 NSString 属性显示在 NSTextView 中吗?
最佳答案
您可以将 NSString 绑定(bind)到 NSTextView 的 value
而不是 attributedString
。为此,您需要关闭 NSTextView 的“富文本”。
关于objective-c - NSTextView,绑定(bind)和显示 NSString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7544236/