1

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

pkamb
  • 33,281
  • 23
  • 160
  • 191
Bertrand Caron
  • 2,525
  • 2
  • 22
  • 49
  • 1
    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. – Cory Oct 15 '13 at 22:29
  • Thats exactly what I was looking for, you should make an answer out of it to get you (well earned) rep ;) – Bertrand Caron Oct 16 '13 at 08:04
  • Glad it helped... I added the comment as an answer – Cory Oct 16 '13 at 20:33

2 Answers2

3

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.

Cory
  • 2,302
  • 20
  • 33
1

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

Bertrand Caron
  • 2,525
  • 2
  • 22
  • 49