triggerChangeNotificationsForDependentKey in subclass of NSArrayController
triggerChangeNotificationsForDependentKey in subclass of NSArrayController
- Subject: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
- From: Gabriele de Simone <email@hidden>
- Date: Thu, 7 Oct 2004 11:57:39 -0400
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
_______________________________________________
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