Question

I have been trying unsuccessfully to use so-called "Header Cells" in my view-based (which I'd like to keep that way) NSOutlineView without success.

I have tried the following things:

  • I have successfully set up -(BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item for the object I want to make headers.

  • I have thoroughly tested my delegate and data-source, so we can assume they are set up properly.

  • When it comes to -(NSView *)outlineView:(NSOutlineView *)ov viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item definition, I am stuck.

I had the feeling from my readings that there are things to set up in IB, but I can't figure out what. What is this @"HeaderCell" referring to?

I tried this kind of stuff which are not successful at all (displays an empty-view)

-(NSView *)outlineView:(NSOutlineView *)ov viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item
{   NSTableCellView *result = nil;
    result = [ov makeViewWithIdentifier:@"HeaderCell" owner:self];
    [[result textField]setStringValue:@"myString"];
    return result;
}

What am I missing ?

Source : View-based NSOutlineView header cell font issues

Était-ce utile?

La solution

The @"HeaderCell" refers to the Table Cell View identifier. In IB select the Table Cell View representing the Header Cell and on the utility sidebar select identity inspector...you should see the identifier field.

Autres conseils

NB : From Cory's Answer

Here's a graphical explanation of how to set it up in Interface Builder :

In IB select the Table Cell View representing the Header Cell and on the utility sidebar select identity inspector...you should see the identifier field

enter image description here

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top