Re: NSUserDefaults, an array, and SIGBUS 10
Re: NSUserDefaults, an array, and SIGBUS 10
- Subject: Re: NSUserDefaults, an array, and SIGBUS 10
- From: Scott Anguish <email@hidden>
- Date: Mon, 29 Jul 2002 10:42:30 -0400
On Monday, July 29, 2002, at 08:32 AM, Ondra Cada wrote:
On Monday, July 29, 2002, at 07:59 , Scott Anguish wrote:
this category on NSUserDefaults adds support for archiving NSColor..
you can see from this how to archive your own data
- (void)setColor:(NSColor *)color forKey:(NSString *)key {
NSData *data=[NSArchiver archivedDataWithRootObject:color];
[self setObject:data forKey:key];
}
Although this works perfectly for any object(*), for colours and
similar values it is much better -- if possible -- to use some string-
or number-based encoding (like RGB values). The difference lays in the
possibility to change the default value easily externally, eg. using
the CLI defaults tool.
RGB is great with the exception that the color you may be storing is
actually CMYK, or Grayscale and the color model is something you want
to preserve as well. What about repeating decimal numbers? Rounding
those sucks. And if you store it as 0.444 and the system uses
0.44444444444444444444.... then you loose precision for comparisons.
While this can be preserved in another manner than archiving, there is
little point to it. What's more, you'd store it one way, someone else
another, etc...
_______________________________________________
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.