Skip navigation.
 
mlRe: Archiving three arrays
FROM : Gore
DATE : Thu Jan 17 20:59:37 2002

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


Related mailsAuthorDate
mlArchiving three arrays Michèle Garoche Jan 17, 20:25
mlRe: Archiving three arrays Gore Jan 17, 20:59
mlRe: Archiving three arrays Nick Müller Jan 17, 21:08
mlRe: Archiving three arrays Enigmarelle Develo… Jan 17, 21:28
mlRe: Archiving three arrays Ondra Cada Jan 17, 22:11
mlRe: Archiving three arrays Michèle Garoche Jan 18, 23:59