Re: NSTextView font problem using arraycontroller
Re: NSTextView font problem using arraycontroller
- Subject: Re: NSTextView font problem using arraycontroller
- From: Jens Alfke <email@hidden>
- Date: Wed, 20 Jan 2010 07:37:55 -0800
On Jan 20, 2010, at 5:27 AM, Grant Christensen wrote:
> I have an array controller that is feeding a NSTableView on a window. Also on the window are a few text fields showing the contents of the selected row (shows more than table). One of the fields is an NSTextView.
What property of the text view are you binding to the controller?
> When I click on a row in the table the text view shows the data under that row for that field, which is a multi line string. The font used seems to be the default font, not what I have set for the view.
I believe what happens is that if you set a string value for the text view's contents, it gets promoted to an attributed string with no styles; but if no styles are set the default ones will be used, i.e. 12pt Helvetica.
What I would do is either write a custom NSValueTransformer that will convert an NSString into an NSAttributedString containing your desired attributes; or bind the controller's value to a property on a custom object of your own, whose setter will set the proper value on the text view.
Or just use an NSTextField instead...
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden