Changing the disclosure triangle in an NSOutlineView

Apple, Cocoa, General

At WWDC I was asked how to remove the disclosure triangle in an NSOutlineView. Well, first things first. You can change it with this bit of code in your delegate:

- (void)outlineView:(NSOutlineView *)ov
  willDisplayOutlineCell:(NSButtonCell *)cell
  forTableColumn:(NSTableColumn *)tableColumn
  item:(id)item
{
  [cell setImage:[NSImage imageNamed:@“collapsedglyph.tiff”]];
  [cell setAlternateImage:[NSImage imageNamed:@“expandedglyph.tiff”]];
}

If you want to set it to nil, you will have to create an image that is empty.

–corbin

Previous Post
no_thumbnail
rail unicycle riding at East Cliff Rd, Santa Cruz, CA (aka: 'the hook')
Next Post
no_thumbnail
Repost: How to find memory leaks in Cocoa apps with Object Alloc

Leave a Reply

avatar
500
  Subscribe  
Notify of

(c) 2008-2019 Corbin Dunn

Privacy Policy

Subscribe to RSS feeds for entries.

72 queries. 0.167 seconds.

Log in