This question has been asked several times over the last few years, but I 
haven't found a useful answer in all the discussions.

How can I make an outline view reinstate the expanded and collapsed state of 
its rows across application launches?

Building in Xcode 5.1.1 under OS X 10.9.4 Mavericks, I select the outline view 
nib file's Autosave checkbox for Autosave Expanded Items, which is equivalent 
to calling -setAutosaveExpandedItems:YES. 

I also implement the outline view data source method 
-outlineView:persistentObjectForItem: by returning -[NSKeyedArchiver 
archivedDataWithRootObject:item] and the data source method 
-outlineView:itemForPersistentObject: by returning -[NSKeyedUnarchiver 
unarchiveObjectWithData:object]. Doing this is the only sense I can make of the 
very cryptic reference document instructions, and this solution is echoed in 
some of the mailing list discussions I found.

It works, up to a point. When I launch the application, NSLog calls tell me 
that it does call -outlineView:itemForPersistentObject: at launch on the 
archived objects for every row that I left expanded when I previously quit. I 
see the correct archived data items in my user defaults preferences file, so I 
know the application properly called -outlineView:persistentObjectForItem: when 
I previously quit. The archived data items unarchive correctly to the outline 
view items that were left expanded when I previously quit.

However, the indicated rows are not expanded at launch. Instead, all rows are 
collapsed at launch.

Has anybody made this work? How?

-- 

Bill Cheeseman - b...@cheeseman.name

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to