• 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: Preference panes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preference panes


  • Subject: Re: Preference panes
  • From: Steven Spencer <email@hidden>
  • Date: Wed, 24 Mar 2004 17:02:59 +0000

In my code, I have created a preferences class. This has methods for getting and setting and each preference. For example :

+ (NSColor *)tableColor;
+ (void)setTableColor:(NSColor *)color;

There are also methods for adding and removing observers :

+ (void)addObserver:(id)anObserver;
+ (void)removeObserver:(id)anObserver;

Observers get notified when a preference changes and make use of the NSNotificationCenter as described in Aaron's book.

Within the class implementation I use the + (void)initialize method to set the preference defaults.


All application areas including the preference pane window, get and set preferences through the preferences class.

- Steve Spencer


On Wednesday, March 24, 2004, at 04:01PM, Chad Armstrong <email@hidden> wrote:

>I am adding a preference pane to an application, and I am trying to
>determine the best route in doing so. My current application has
>several different classes which need to access the preferences. Should
>I declare a new set of preferences in each class to access them, or
>should I take another route?
>
>An brief example in the book Cocoa Programming for Mac OS X by Aaron
>Hillegass shows creating a whole new NIB for the preference pane.
>Would this be the ideal way for my several classes to interact with the
>preference pane? I would also like to save any user selected options
>in the process, too.
>
>Chad Armstrong
>_______________________________________________
>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.


  • Prev by Date: Preference panes
  • Next by Date: Memory management question
  • Previous by thread: Preference panes
  • Next by thread: Why isn't my NSComboBox editable?
  • Index(es):
    • Date
    • Thread