• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bindings: Changes dependent on keypaths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Re: NSAppleScript no longer allows user interaction?
  • Next by Date: Re: NSAppleScript no longer allows user interaction?
  • Previous by thread: Re: Multiple windows from single nib-window object
  • Next by thread: efficient searching of arrays
  • Index(es):
    • Date
    • Thread