• 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: persistence and NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: persistence and NSOutlineView


  • Subject: Re: persistence and NSOutlineView
  • From: Alex Rice <email@hidden>
  • Date: Fri, 31 May 2002 18:20:50 -0600

On Friday, March 22, 2002, at 11:22 PM, Anders Pytte wrote:

I don't "get" what the persistence features of NSOutlineView (and its data delegate) are for.

Can someone give me the basic idea?

Anders, Hi I have asked the same question recently on cocoa-dev and macosx-dev lists and got no responses, except someone else asking if I figured it out ;-)

Alas, I still don't understand *how* NSOutlineView does this, but I have got it working, and it's cool. The basic idea behind the persistence methods in NSOutlineView is so that if you have [olview setAutosaveExpandedItems:YES]; then the NSOutlineView can use object persistence to take "snapshots" of the expansion state of each item. Then when your app or document is loaded at some time in the future, the outlineview can set the expansions of the outlineview items for the user.

The implementation is very simple if your node items implement NSCoding. I've put together a sample project illustrating this. If you have studied Apple's appkit example DragNDropOutlineView, this might be a good one to look at as well because I have simplified the node class for an outlineview datasource compared to the DragNDropOutlineView project.

http://www.mindlube.com/files/cocoa/NSOutlineViewPersistence.tar.gz

Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/
_______________________________________________
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.

  • Prev by Date: Re: setUsesThreadedAnimation
  • Next by Date: Is there a way I can fix these warnings?
  • Previous by thread: Re: setUsesThreadedAnimation
  • Next by thread: Is there a way I can fix these warnings?
  • Index(es):
    • Date
    • Thread