• 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: Standard User Defaults - Setting initial values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Standard User Defaults - Setting initial values
      • From: Bruce Truax <email@hidden>
References: 
 >Standard User Defaults - Setting initial values (From: Bruce Truax <email@hidden>)

  • Prev by Date: Re: I need a suggestion for making a "console" window
  • Next by Date: Re: "Merged cells"
  • Previous by thread: Standard User Defaults - Setting initial values
  • Next by thread: Re: Standard User Defaults - Setting initial values
  • Index(es):
    • Date
    • Thread