Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTextView, bindings and displaying an NSString

My second day working with Cocoa. I've got an NSTextView set up, its attributed string is bound to an NSArrayController (I'm using Core Data):

controller key: selection
model key path: myString

I've read that an NSTextView needs an NSAttributedString, which is why it's throwing an exception when trying to set the value of the attribute.

NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "myString"; desired type = NSString; given type = NSConcreteAttributedString; 

Any ideas how I can get my managedObject's NSString attribute to be shown in an NSTextView?

like image 838
nathan Avatar asked Sep 25 '11 07:09

nathan


1 Answers

You can bind your NSString to NSTextView's value instead of attributedString. For this, you need to turn off "Rich Text" for NSTextView.

like image 108
dchest Avatar answered Sep 28 '22 02:09

dchest