Re: Saving arrays with NSUserDefaults?
Re: Saving arrays with NSUserDefaults?
- Subject: Re: Saving arrays with NSUserDefaults?
- From: "Louis C. Sacha" <email@hidden>
- Date: Tue, 29 Jun 2004 19:53:02 -0700
Hello...
In addition to the option of archiving objects of your Preset class
as Nick suggested, another option would be to use an NSDictionary to
hold your presets instead of a custom class.
If your Preset class has methods besides regular accessor methods,
then you could instead implement an initializer that takes an
NSDictionary of presets and initializes an instance of Preset with
those values, and an instance method that exports itself as a
dictionary.
Since all of the instance variables in your class can be represented
as property list objects (storing the floats, BOOLs, and ints in a
NSNumber), the dictionary could be stored normally in the user
defaults without archiving.
Louis
...
'presets' is an NSMutableArray consisting of several of these:
@interface Preset : NSObject
{
NSString* name;
float intensity;
float sensitivity;
float fade;
float zoom;
float zoomRotation;
int numLines;
float r1,g1,b1;
float r2,g2,b2;
bool smooth;
bool glow;
bool cycle;
bool sharpOverlay;
int scaleSystem;
};
@end;
...
Thanks,
Jon
_______________________________________________
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.