Re: Monitoring an NSArrayController
Re: Monitoring an NSArrayController
- Subject: Re: Monitoring an NSArrayController
- From: mmalc crawford <email@hidden>
- Date: Thu, 9 Aug 2007 07:25:30 -0700
On Aug 9, 2007, at 6:12 AM, Michael Fey wrote:
[vegetableController addObserver:self
forKeyPath:@"arrangedObjects.name" (NSKeyValueObservingOptionNew|
NSKeyValueObservingOptionOld) context:NULL];
Our observer method then looks like this:
- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:
(id)Object change:(NSDictionary*)change context:(void*)context
{
if ([keyPath @"arrangedObjects.name"]) {
It is typically better form to provide a context and test that rather
than a keypath.
The problem that we're running into is that [change
objectForKey:NSKeyValueChangeNewKey] is always coming up null (as is
objectForKey:NSKeyValueChangeOldKey). Also, the keyValueChangeKind
always seems to be NSKeyValueChangeSetting, even when we're adding
to the NSArrayController through the GUI. Can someone point us in
the right direction?
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
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