Re: Is NSTableView sortDescriptors KVO compliant?
Re: Is NSTableView sortDescriptors KVO compliant?
- Subject: Re: Is NSTableView sortDescriptors KVO compliant?
- From: mmalc crawford <email@hidden>
- Date: Thu, 13 Dec 2007 18:37:47 -0800
On Dec 13, 2007, at 6:21 PM, Adhamh Findlay wrote:
I have an NSTableView subclass and I want to use KVO to detect when
the sort descriptors change so that I can save them. The idea is
that when the user comes back to the table the columns will be
sorted the same way they last saw them.
Here's the addObserver call:
[self addObserver: self forKeyPath: @"tableView.selectionIndexes"
options:NSKeyValueObservingOptionNew context:self];
[self addObserver: self forKeyPath: @"tableView.sortDescriptors"
options:NSKeyValueObservingOptionNew context:self];
No, you should be observing the object to which the table view's
sortDescriptors property is bound (typically the array controller --
see <http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTableView.html#//apple_ref/doc/uid/NSTableView-DontLinkElementID_621
>). The general point is that you don't observe views -- views are
the things that do the observing.
This leads me to believe that sortDescriptors is not KVO compliant,
but its listed in the bindings reference for NSTableViewhttp://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTableView.html
Similar to the previous point, the bindings reference lists properties
that can be bound, not those that are observable.
mmalc
_______________________________________________
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