• 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: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)


  • Subject: Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
  • From: Jonathan Dann <email@hidden>
  • Date: Thu, 26 Jun 2008 19:29:48 +0100

Here's what I do:

@"isExpanded" is a persistent attribute of my model objects.

In the delegate

- (void)outlineViewItemDidExpand:(NSNotification *)notification;
{
[[[[notification userInfo] valueForKey:@"NSObject"] representedObject] setValue:[NSNumber numberWithBool:YES] forKey:@"isExpanded"];
}


- (void)outlineViewItemDidCollapse:(NSNotification *)notification;
{
[[[[notification userInfo] valueForKey:@"NSObject"] representedObject] setValue:[NSNumber numberWithBool:NO] forKey:@"isExpanded"];
}


In an NSOutlineView subclass

- (void)reloadData;
{
	[super reloadData];
	NSUInteger row;
	for (row = 0 ; row < [self numberOfRows] ; row++) {
		NSTreeNode *item = [self itemAtRow:row];
		if ([[item representedObject] isMemberOfClass:[ESGroupNode class]])
			if ([[[item representedObject] valueForKey:@"isExpanded"] boolValue])
				[self expandItem:item];
	}
}


works like a charm

Jon

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >[NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded) (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Good mouse tracking design for dynamic view?
  • Next by Date: Re: [Moderator] List Guidelines - Must Read
  • Previous by thread: Re: [NSOutlineView] Saving/Restoring the hierarchy disclosure state (Reloaded)
  • Next by thread: NSWindow setIgnoresMouseEvents and Spaces
  • Index(es):
    • Date
    • Thread