Domanda

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

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top