• 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: Scott Anguish <email@hidden>
  • Date: Sun, 18 Apr 2004 15:19:30 -0400

I'm not exactly sure how binding a model to another controller will work. Especially if you don't implement NSEditor and NSEditorRegistration.

a better solution would be to register to observe those default values manually, or make the acccessor methods for those just read the default rather than read it from the model


On Apr 18, 2004, at 1:50 PM, Allan Odgaard wrote:

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.
_______________________________________________
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: Allan Odgaard <email@hidden>
References: 
 >Re: NSObjectController and NSDefaultsController Binding? (From: Bruce Truax <email@hidden>)
 >Re: NSObjectController and NSDefaultsController Binding? (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: CodeWarrior vs. Xcode?
  • Next by Date: Rapid use of NSTextField
  • Previous by thread: Re: NSObjectController and NSDefaultsController Binding?
  • Next by thread: Re: NSObjectController and NSDefaultsController Binding?
  • Index(es):
    • Date
    • Thread