OverridevalueForUndefinedKey:
:- (id) valueForUndefinedKey: (NSString *) key { id value; value = [self lookUpValueUsingSomeOtherMechanism: key]; if (value == nil) { value = [super valueForUndefinedKey: key]; } return (value); } // valueForUndefinedKeySome handy uses for this is using the user defaults for storing values (you can use the key directly to[NSUserDefaults stringForKey:]
, or use it to query the contents of anNSDictionary
The counterpart for this is
- (void) setValue: (id) value forUndefinedKey: (NSString *) key
, which you can use to stash stuff into user prefs or a dictionary.