Re: Sharing preferences
Re: Sharing preferences
- Subject: Re: Sharing preferences
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 30 Mar 2005 05:38:57 -0500
on 2005-03-29 7:01 PM, Chad Armstrong at email@hidden wrote:
> What would be the most effective way to share the data between the
> various controller classes? Would it be advisable to create another
> controller (and associated files) just for the preference window and its
> controls/buttons, also?
Leaving aside Cocoa Bindings, the traditional approach would be to create a
separate nib file and controller for your preferences window and its
controls, just as you normally would for any separate window having its own
layout.
As to the preference data, you would use NSUserDefaults, which is well
documented. Initialize non-nil preference items in a +initialize method in
your preferences controller. Set individual preference items in your
preferences controller in response to user actions in the preferences
window. Read individual preference items whenever and wherever you need to
know how they're set, by accessing the NSUserDefaults singleton object.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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