Re: Saving is so darn hard!
Re: Saving is so darn hard!
- Subject: Re: Saving is so darn hard!
- From: Charles Srstka <email@hidden>
- Date: Mon, 1 Apr 2002 12:59:24 -0600
On Sunday, March 31, 2002, at 10:21 PM, Brian Webster wrote:
On Sunday, March 31, 2002, at 06:17 PM, cocoa-dev-
email@hidden wrote:
On Sunday, March 31, 2002, at 04:20 PM, deekpyro wrote:
What I want to do is have it save the state of the checkbox so the
next
time
the app starts up it is at the state that it was when it was last
closed.
Any ideas?
Um, do exactly what you were doing, except don't set the preference to
YES every time the application loads. In other words, leave out what
you
were doing in the initialize method, and just do the stuff in the
windowDidLoad and the check box action.
Actually, the registerDefaults method of NSUserDefaults does not
overwrite defaults that have been set with setObject:, setBool;, etc.
It's used for registering "default defaults" that are used when no setX
method has been called for a particular key. These defaults are stored
in the NSRegistrationDomain, but that domain is overridden by the
application domain, which is the one that is written to by
setBool:forKey:. See the NSUserDefaults programming topic for more
information on defaults domains.
Interesting. Learn something every day on this list.
One other thing is to make sure the windowDidLoad method actually loads
when the program starts. I could be wrong, but I think that
windowDidLoad is a method of NSWindowController that you can only
override if you are a subclass of that class. You might want to try
awakeFromNib or applicationDidFinishLaunching: instead.
Yes, this is probably the reason it doesn't work, since the value will
never be read.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.