• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Archiving three arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Archiving three arrays (From: Michèle Garoche <email@hidden>)

  • Prev by Date: Using NSComboBoxCells within NSTableView
  • Next by Date: Re: getting a different kind of TIFF file recognized...
  • Previous by thread: Archiving three arrays
  • Next by thread: Re: Archiving three arrays
  • Index(es):
    • Date
    • Thread