Re: Standard User Defaults - Setting initial values
Re: Standard User Defaults - Setting initial values
- Subject: Re: Standard User Defaults - Setting initial values
- From: Scott Anguish <email@hidden>
- Date: Mon, 26 Apr 2004 01:33:58 -0400
On Apr 25, 2004, at 10:27 PM, Bruce Truax wrote:
When using the Shared User Defaults Binding for UI elements, what is
the
proper way to set the initial values that the user will see on the
first
run?
Register them with NSUserDefaults using registerDefaults:. and you
need to do that before any nibs load (so an app delegate +initialize
method, or willFinishLaunching: delegate method.
---
Care must be taken that changes to the settings of the shared user
defaults controller are made before any nib files containing bindings
to the shared controller are loaded. To ensure that these changes are
made before any nib files are loaded, they are often implemented in the
initialize class method of the application delegate, or in your
preferences window controller.
---
The initial values dictionary allows you to provide a means to reset
the user configurable default values to the factory defaults. Typically
these values represent a subset of the defaults that your application
registers using the NSUserDefaults method registerDefaults:.
Calling the NSUserDefaultsController method setInitialValues: should
not be considered a replacement for registering your application's
preference defaults using NSUserDefault's registerDefaults: method.
The example in Listing 2 loads the default values from a file in the
application wrapper, registers those values with NSUserDefaults, and
then registers a subset of the values as the initial values of the
shared user defaults controller. The setupDefaults method would be
called from your application delegates initialize class method.
---
_______________________________________________
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.