How can I change the style for nodes in NSOutlineView?
2 answers
When I faced a similar issue, @Benedict's mention method never worked for me. This is because NSOutlineView has a separate method:
- (void) outlineView:(NSOutlineView*)aTableView
willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn*)aTableColumn
item:(id)item;
See the documentation for the NSOutlineViewDelegate protocol . (This formal protocol is new in 10.6 - in previous versions of OS X, methods were implemented as a category in NSObject.)
+3
source to share
NSOutlineView
is a subclass NSTableView
. Add tableView:willDisplayCell:forTableColumn:row:
to the delegate NSOutlineView
.
In tableView:willDisplayCell:forTableColumn:row:
implementing something like this:
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([aTableView isGroupRow: rowIndex]) {
//modify aCell
}
}
+3
source to share