Re: Colors and NSUserDefaults
Re: Colors and NSUserDefaults
- Subject: Re: Colors and NSUserDefaults
- From: Jeremy Dronfield <email@hidden>
- Date: Tue, 9 Jul 2002 21:56:51 +0100
It works perfectly. Thanks for drawing it to my attention. My
colour-related code is now about 70 per cent shorter than it was!
- Jeremy.
On Tuesday, July 9, 2002, at 03:50 pm, Paul Ferguson wrote:
Jeremy Dronfield wrote:
I'm trying to put a colour value into my NSUserDefaults object. I
tried using:
[prefs setObject:[myColorWell color] forKey:@"ColorSetting"];
which gives me a signal 10. There's nothing wrong with my prefs
object; it puts other values into the .plist file perfectly well.
Also, myColorWell performs its function in the application just fine,
so there can't be a problem with that. The only other default setting
methods are bool, float and integer, none of which are appropriate.
- Jeremy.
Take a look at the JabberFoX source code (jabberfox.sourceforge.net).
The files NSUserDefaults-Colors.h/.m adds two methods to NSUserDefaults:
- (NSColor *)colorForKey:(NSString *)defaultName;
- (void)setColor:(NSColor *)value forKey:(NSString *)defaultName;
that make saving and restoring color preferences trivial.
_______________________________________________
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.