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
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 mails | Author | Date |
|---|---|---|
| Michèle Garoche | Jan 17, 20:25 | |
| Gore | Jan 17, 20:59 | |
| Nick Müller | Jan 17, 21:08 | |
| Enigmarelle Develo… | Jan 17, 21:28 | |
| Ondra Cada | Jan 17, 22:11 | |
| Michèle Garoche | Jan 18, 23:59 |






Cocoa mail archive

