Re: NSObjectController and NSDefaultsController Binding?
Re: NSObjectController and NSDefaultsController Binding?
- Subject: Re: NSObjectController and NSDefaultsController Binding?
- From: Allan Odgaard <email@hidden>
- Date: Sun, 18 Apr 2004 19:50:12 +0200
On 18. Apr 2004, at 13:35, Bruce Truax wrote:
My application uses numerous dialog boxes which require the user to set
options and enter parameter data. I want all of these settings and
data to
be persistent between sessions so I want to save them as User Defaults.
This is simple with NSUserDefaultsController. It would also be nice
if the
variables in the model object were automatically updated as the user
modified the dialog. [...]
You can (manually) bind these to the user defaults controller as well.
[model bind:@"title"
toObject:[NSUserDefaultsController sharedUserDefaultsController]
withKeyPath:@"values.title"
options:nil];
After this, when the value (bound to the "values.title" key path in the
user defaults controller) of some view object is changed, then the
model object will receive a setValue:forKey: (where key is 'title'),
which by default will update the instance variable.
Alternatively you can just query the shared user defaults each time you
need a value, as what you are doing is just sort of a cache, isn't it?
** Cocoa FAQ: <
http://www.alastairs-place.net/cocoa/faq.txt> **
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.