0

I'm trying to make an outline cell display an attributed string in Bold text. This is a cell-based outline.

Here is how I create the attributedString:

anObject.name =[[NSMutableAttributedString alloc]initWithString:@"Draft Chapters"]  ;
[anObject.name beginEditing];
[anObject.name applyFontTraits:NSBoldFontMask range:NSMakeRange(0, 14)];
[anObject.name endEditing];

Here is how I set the value of the cell:

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
    return [(AnObject*)item name];  //I ignored tableColumn as this is a 1 column outline.
}

The cell appears as Normal text, but the user can edit it to Bold etc.

Carl Carlson
  • 500
  • 4
  • 17
  • I think you somehow don't return the same "Draft Chapters" as the bold created "Draft Chapters". Did you check the return value of `objectValueForTableColumn`? – Willeke Mar 03 '17 at 11:03
  • Thanks. Following your advice I checked earlier today. It's still an attributedString. After wasting too much time, I give up. – Carl Carlson Mar 03 '17 at 18:51

0 Answers0