Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 11, 2009, 06:39 PM   #1
BollywooD
macrumors 6502
 
Join Date: Apr 2005
Location: Surfers Paradise
[cell setTransparent] in NSOutlineView

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>

Last edited by BollywooD; Apr 11, 2009 at 06:54 PM.
BollywooD is offline   0 Reply With Quote
Old Apr 13, 2009, 08:02 AM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
I've never used NSTreeController before, but try implementing an isLeaf method in your object. From the docs:
Quote:
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.
kainjow is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Bind NSOutlineView & NSTextView to NSTreeController? ArtOfWarfare Mac Programming 3 Dec 9, 2012 12:25 PM
Allow NSOutlineView to be rearranged? ArtOfWarfare Mac Programming 2 Dec 5, 2012 11:48 PM
Issue with NSOutlineView? jaquadro Mac Programming 0 Nov 4, 2012 05:12 PM
NSOutlineView Source List Child Item Titles Disappearing mkmDesign Mac Programming 1 Oct 26, 2012 01:46 PM
NSOutlineView objects being released perrien Mac Programming 3 Aug 28, 2012 07:47 AM

Forum Jump

All times are GMT -5. The time now is 01:00 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC