outlineView:persistentObjectForItem: - autosaving of outline state
outlineView:persistentObjectForItem: - autosaving of outline state
- Subject: outlineView:persistentObjectForItem: - autosaving of outline state
- From: Luke Evans <email@hidden>
- Date: Tue, 12 Feb 2008 15:20:13 -0800
Hello Cocoa list.
I'm trying to implement autosaving of outline expansion with an
NSOutlineView bound to data via NSTreeController.
Of course, in Leopard, this means that the tree items will appear as
NSTreeNode instances.
When outlineView:persistentObjectForItem: is called it passes the
instance of NSTreeNode and the documentation simply suggests that I
should return an 'archive' object. I've tried this with
NSKeyedArchiver, but NSTreeNode presumably doesn't conform to the
NSCoding protocol.
So, I'm guessing that something more 'involved' is called for (i.e.
this simple interpretation of the docs is naive). What I'm not sure
about is whether in outlineView:itemForPersistentObject: I'm supposed
to return any old NSTreeNode that is equivalent to the one that should
be in the tree (i.e. can be found by matching with hash and/or
isEqual:), or whether I'm supposed to return an exact instance of the
matching item in the current tree. Clearly the latter would involve
searching through the tree's current nodes, and it doesn't seem that
this would be expected, as its awfully clunky.
Any insights would be very much appreciated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden