Bindings: Changes dependent on keypaths
Bindings: Changes dependent on keypaths
- Subject: Bindings: Changes dependent on keypaths
- From: Allen Smith <email@hidden>
- Date: Mon, 14 Aug 2006 11:34:11 -0700
I have a class whose data is mostly packaged into an
NSMutableDictionary:
@interface Controller : NSObject
{
NSMutableDictionary *dialogData;
}
Then my controls' values are bound to the data in the dictionary
using keypaths such as "dialogData.value". Now I want to bind another
control to a method in the Controller class whose return value is
partially derived from data in the dictionary. Conceptually, I want
to do the following:
@implementation Controller
+ (void) initialize
{
//this does not work!
[self setKeys:[NSArray arrayWithObject:@"dialogData.value"]
triggerChangeNotificationsForDependentKey:@"pictogram"];
}
- (NSImage *) pictogram
{
if( [[dialogData objectForKey:@"value"] isEqual:foo] )
return bar;
else
return baz;
}
@end
Observing keypaths doesn't work like this. So what am I supposed to
do instead? (Note: my dependent key result might be built from
multiple values in the dictionary, so a value transformer could get a
little goofy here.)
_______________________________________________
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