Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
- Subject: Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
- From: Jacob Lukas <email@hidden>
- Date: Thu, 7 Oct 2004 20:33:00 -0700
On Oct 7, 2004, at 8:57 AM, Gabriele de Simone wrote:
Esteemed members of the Cocoa Bindings cult,
It seems that if I add a new key to an NSArrayController and make
"arrangedObjects" dependent on that key, the change notifications when
the key is modified are never sent (or at least my views dependent on
"arrangedObjects" don't get updated). Here's the scenario:
+ (void) initialize {
[self exposeBinding:@"myKey"];
[self setKeys:[NSArray arrayWithObjects:@"myKey", nil]
triggerChangeNotificationsForDependentKey:@"arrangedObjects"];
}
+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {
if ([key isEqualToString:@"myKey"]) {
return NO;
}
return [super automaticallyNotifiesObserversForKey:key];
}
- (void) setMyKey:(NSString*)myKey {
if (_myKey != myKey) {
[self willChangeValueForKey:@"myKey"];
_myKey = [myKey copy];
[self didChangeValueForKey:@"myKey"];
}
}
The obvious solution is to call [self rearrangeObjects] in the setter
method, but I am more interested in knowing whether I have
misunderstood/ignored some properties of NSControllers.
Thanks,
Gabriele
I had a similar problem, with the
setKeys:triggerChangeNotificationsForDependentKey: not triggering for
dependent keys. I posted my solution here:
http://www.cocoabuilder.com/archive/message/cocoa/2004/10/1/118614
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden