FROM : Gabriele de Simone
DATE : Thu Oct 07 17:57:39 2004
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
DATE : Thu Oct 07 17:57:39 2004
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
| Related mails | Author | Date |
|---|---|---|
| Gabriele de Simone | Oct 7, 17:57 | |
| Shaun Wexler | Oct 7, 18:09 | |
| Gabriele de Simone | Oct 7, 19:44 | |
| Shaun Wexler | Oct 7, 20:45 | |
| Gabriele de Simone | Oct 7, 22:15 | |
| Jacob Lukas | Oct 8, 05:33 | |
| Steven Kramer | Oct 9, 15:46 |






Cocoa mail archive

