• 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
Re: NSObjectController and NSDefaultsController Binding?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: NSObjectController and NSDefaultsController Binding?
      • From: Scott Anguish <email@hidden>
References: 
 >Re: NSObjectController and NSDefaultsController Binding? (From: Bruce Truax <email@hidden>)

  • Prev by Date: NSMenuItem Key Equivalents, keyDown events, and system beeps
  • Next by Date: Re: CodeWarrior vs. Xcode?
  • Previous by thread: Re: NSObjectController and NSDefaultsController Binding?
  • Next by thread: Re: NSObjectController and NSDefaultsController Binding?
  • Index(es):
    • Date
    • Thread