Re: Retrieving "default" defaults after registerDefaults?
Re: Retrieving "default" defaults after registerDefaults?
- Subject: Re: Retrieving "default" defaults after registerDefaults?
- From: Matt Gemmell <email@hidden>
- Date: Mon, 08 Apr 2002 02:47:54 +0100
On 7/4/02 10:36 pm, Doug Brown <email@hidden> wrote:
>
> My question is, can I programmatically access the original "default" values I
>
> registered, so that I can elegantly implement a "Factory Settings" button in
>
> my preferences window?
>
Have you tried this?
>
>
[[NSUserDefaults standardUserDefaults]
>
removeObjectForKey:@"DefaultsKey"];
Hi Doug,
Thanks for your reply. :)
I noticed that method in the NSUserDefaults documentation; the reason I
didn't want to use it is that the user can cancel my preferences window
(click the Cancel button instead of the OK button), presumably intending to
discard any changes they've made - including having clicked the Factory
Settings button. Using the registered "default" defaults means I can revert
to the user's previous settings without needing to keep track of their old
settings manually (actually, without any code at all!)
Cheers,
-Matt
--
Matt Gemmell
Scotland Software
<
http://www.scotlandsoftware.com/>
_______________________________________________
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.