• 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
Observing with NSDictionarycontroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Observing with NSDictionarycontroller


  • Subject: Observing with NSDictionarycontroller
  • From: William Henderson <email@hidden>
  • Date: Wed, 13 Feb 2008 23:08:12 -0800

An app I'm working on uses Leopards new NSDictionaryController to bind up some TableViews to the model. Actually, it uses two NSDictionaryControllers - there is one we'll call A which consists of a bunch of dictionaries for that are hooked up to NSDictionaryController B (via A.selection.value). Now I want to respond to changes - ideally I'd like to know when someone adds, removes or modifies any key-value pair. To get notifications, I could observe A using
[self addObserver:self forKeyPath:@"DictionaryA"
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:NULL];


and handling with observeValueForKeyPath. This gives the notifications, but they don't have any specificity about what actually changes. Whether it's an added key-value pair to B, a modified value of a key in B, or an added key-Dictionary pair to A - it always sends 1 for NSKeyValueChangeKindKey, and send the whole of Dictionary A for the NSKeyValueChangeNewKey, NSKeyValueChangeOldKey, and NSKeyValueChangeIndexesKey keys. Of course there are other points where I could be catching the changes, but I was hoping I could find a way to do it here – but I can't figure it our nor can I find much documentation about using Leopard's newest bindings controller. Thanks!

wc_______________________________________________

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


  • Prev by Date: Re: how to simulate passing parameter with selector
  • Next by Date: NSComboBox / NSTableView help
  • Previous by thread: Disable Expose didn't work in leopard
  • Next by thread: NSComboBox / NSTableView help
  • Index(es):
    • Date
    • Thread