How to make outlineView:objectValueForTableColumn:.. accept an attributedString

58 Views Asked by At

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.

0

There are 0 best solutions below