View-based NSTableView / NSOutlineView and isGroupItem

I have a view based NSOutlineView related to NSTreeController. Everything seems to work correctly until I implement the method outlineView:isGroupItem:in my deletion, after which the group header suddenly stops showing up. Like this

enter image description here

I confirmed that if I changed NSOutlineView to a cell, then the group element would appear correctly. A similar behavior is observed for NSTableView. Has anyone else encountered this problem?

+5
source share
1 answer

I decided!

It turned out that I had to implement the following method in the delegate NSOutlineView

- (NSView *)outlineView:(NSOutlineView *)outlineView 
     viewForTableColumn:(NSTableColumn *)tableColumn
                   item:(id)item {
    if ([self outlineView:outlineView isGroupItem:item]) {
        NSString *vId = [[[outlineView tableColumns] objectAtIndex:0] identifier];
        return [outlineView makeViewWithIdentifier:vId owner:self];
    }
    return [outlineView makeViewWithIdentifier:[tableColumn identifier] owner:self];
}

-, NSOutlineView, , , . / tableColumm, , .

TableViewPlayground ! !

+11

All Articles