• 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: Saving NSTableView data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving NSTableView data


  • Subject: Re: Saving NSTableView data
  • From: email@hidden
  • Date: Fri, 28 Jun 2002 07:58:33 -0500

Sherm's quite correct (as he normally is!) .. The writeToFile works wonderfully if you have as the base
either an NSArray or NSDictionary and that the actual CONTENTS of the NSArray / NSDictionary elements contain nothing but
the allowed "pllist" types of NSString, NSData, NSArray, NSDictionary, etc.

I am working on a more general solution to saving "generic" objects in plist format (writeToFile) by
creating a XMLPlist "protocol" that home grown objects would "implement" to save themselves
as dictionaries and restore themselves from a dictionary including "recursion" .. but
avoiding cyclic object graphs for the moment.. (v2? LOL )

Of course..if anyone else has done this already!! (Sigh.. I want the generic EORecord and stuff back into Obj-c from EOF!!
Hell, I want EOF back into Obj-c!! :-)

Cheers!

-SJM

On Friday, June 28, 2002, at 12:57 AM, Sherm Pendley wrote:

On Thursday, June 27, 2002, at 03:00 PM, Aidas wrote:

I have a NSTableView. It has multiple collumns. How could I save it's data
into file and later read it?

I'm assuming that what you really want to do is save the data from the NSTableView's data source, which should be an object that implements the NSTableDataSource protocol.

I'm also assuming that the data source is implemented internally as an NSArray of rows, with each row containing an NSDictionary of named columns. Or perhaps it's vice-versa, and your columns collection is topmost, with each column containing an array of rows.

Either way, whether the top-level collection object is an NSArray or an NSDictionary, you can use its writeToFile:atomically: method to store its contents to a file in property list (plist) format, and initWithContentsOfFile: method to recreate it.

sherm--

Never put off until tomorrow what you can do today. There might be a law against it by that time.
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Re: Saving NSTableView data (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Authorization Example needed
  • Next by Date: Autosaving a window's frame
  • Previous by thread: Re: Saving NSTableView data
  • Next by thread: Re: Saving NSTableView data
  • Index(es):
    • Date
    • Thread