Re: Archiving three arrays
Re: Archiving three arrays
- Subject: Re: Archiving three arrays
- From: Gore <email@hidden>
- Date: Thu, 17 Jan 2002 21:59:37 +0200
Use 3 arrays for the your data and then put the 3 arrays into one
dictionary with different keys, like this:
- (NSData *)archivePathArray:(NSArray *)pathA colorArray:(NSArray
*)colorA widthArray:(NSArray *)widthA
{
NSMutableDictionary *theRoot = [[NSMutableDictionary alloc] init];
[theRoot setObject: pathA forKey: @"paths"];
[theRoot setObject: colorA forKey: @"colors"];
[theRoot setObject: widthA forKey: @"widths"];
return [NSArchiver archivedDataWithRootObject: theRoot];
}
to get the arrays from the dictionary you must call this (path array for
example):
NSArray *pathA = [theRoot objectForKey: @"paths"];
// Gore
------------------------
Hello,
I've a small application that draws bezier paths at differents
locations, with different colors and line widths. Paths, colors and
widths are managed as arrays.
How do I archive / unarchive three arrays with one NSData object?
Any hint would be appreciated,
Michhle