observing changes in an NSArrayController's selection
observing changes in an NSArrayController's selection
- Subject: observing changes in an NSArrayController's selection
- From: Chuck Musser <email@hidden>
- Date: Sat, 24 Jul 2004 19:12:11 -0700
When I use KVO to observe my NSArrayController's selection, my
observeValueForKeyPath: ofObject: change: context: method gets called,
but the contents of the "change" parameter are not what I expect. This
dictionary contains "kind" and "new" keys, but the value associated with
the "new" key is always NSNull.
I'm registering for notifications like this:
[myArrayController addObserver:self
forKeyPath:@"selection"
options:(NSKeyValueObservingOptionNew)
context:NULL];
I do this in the awakeFromNib method in my main controller object. As it
now stands, the observed array gets its selection changed and new items
are added to the array.
The observeValueForKeyPath... method tries to access the changed value
like this:
NSLog("changeValue distance=%d", [[changeValue distance] intValue]);
Which results in this message in the Run Console:
2004-07-24 18:59:34.059 Ride Log[578] *** -[NSNull distance]: selector
not recognized
2004-07-24 18:59:34.064 Ride Log[578] Exception raised during posting of
notification. Ignored. exception: *** -[NSNull distance]: selector not
recognized.
Any ideas on what I'm doing wrong here?
Chuck
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.