: Correction: NSOutlineView setAutosaveExpandedItems

  • sorry my sample code should of read

    > - (void)awakeFromNib
    > {
    > ...
    > [_outlineView setAutosaveName:__AUTOSAVE_NAME__];
    > [_outlineView setAutosaveExpandedItems:TRUE];
    > ...
    > }
    >
    >
    > - (id)outlineView:(NSOutlineView *)outlineView
    > itemForPersistentObject:(id)object
    > {
    > return [NSKeyedUnarchiver unarchiveObjectWithData:object];  //
    > correction!!!
    > }
    >
    > - (id)outlineView:(NSOutlineView *)outlineView
    > persistentObjectForItem:(id)item
    > {
    > return [NSKeyedArchiver archivedDataWithRootObject:[item timeStamp]];
    > }
    >

    On 17 Apr 2006, at 11:31, nick briggs wrote:

    > Im trying to get my outline view to work with
    > setAutosaveExpandedItems, using the code listed below
    >
    > [item timeStamp] returns a unique NSString (used extensively
    > throughout my app)
    >
    > both datasource methods are called and I have verified that the
    > timestamps are properly archived and unarchived.... however the
    > outlineviews expanded state is not restored.
    >
    > incidentally if i archive and unarchive the actual items, rather
    > than the items timestamps i get the same issue, I would not want to
    > do that as the items are complex and my would be inefficient,
    > however I am led to believe by the docs that it should work.
    >
    > Any ideas? I can find no sample code with this working.
    >
    > Thanks in advance
    >
    > Nick
    >
    >
    > -------
    >
    > - (void)awakeFromNib
    > {
    > ...
    > [_outlineView setAutosaveName:__AUTOSAVE_NAME__];
    > [_outlineView setAutosaveExpandedItems:TRUE];
    > ...
    > }
    >
    >
    > - (id)outlineView:(NSOutlineView *)outlineView
    > itemForPersistentObject:(id)object
    > {
    > id item = [NSKeyedUnarchiver unarchiveObjectWithData:object];
    > }
    >
    > - (id)outlineView:(NSOutlineView *)outlineView
    > persistentObjectForItem:(id)item
    > {
    > return [NSKeyedArchiver archivedDataWithRootObject:[item timeStamp]];
    > }
    >
    >
    > -----------
    >