• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is NSTableView sortDescriptors KVO compliant?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Is NSTableView sortDescriptors KVO compliant?
      • From: Scott Anguish <email@hidden>
References: 
 >Is NSTableView sortDescriptors KVO compliant? (From: Adhamh Findlay <email@hidden>)

  • Prev by Date: Re: [Worse] Re: [NSImage initWithData]: Memory leak. Bug in code or in Framework?
  • Next by Date: Solved: Creating Smaller PDFs.
  • Previous by thread: Is NSTableView sortDescriptors KVO compliant?
  • Next by thread: Re: Is NSTableView sortDescriptors KVO compliant?
  • Index(es):
    • Date
    • Thread