Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BollywooD

macrumors 6502
Original poster
Apr 27, 2005
369
46
Hamburg
I am using this method to hide the disclosure triangle, in nonexpandable items in an NSOutlineView:

Code:
- (void)outlineView:(NSOutlineView *)theOutlineView willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
	if ([item count] == 0)
        [cell setTransparent:YES];
	else
        [cell setTransparent:NO];
}

it does what i want, but slows the OutlineView down to a crawl. Is there a better way to implement this?
I only want a disclosure triangle shown for expandable items... not every item in my OutlineView.

thanks in advance

<edit>Should mention, I am using NSTreeController for the Datasource</edit>
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I've never used NSTreeController before, but try implementing an isLeaf method in your object. From the docs:
You can optionally provide a leaf key path that specifies a key in your model object that returns YES if the object is a leaf node, and NO if it is not. Providing this key path prevents the NSTreeController from having to determine if a child object is a leaf node by examining the child object and as a result improve performance.

Edit: if you're targeting 10.5+ with your app, it might help to make your node objects a subclass of NSTreeNode.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.