Reputation: 40211
I'm trying to add some formatting to the cells in a view-based NSOutlineView. No matter what I try, the text is rendered without any format I specify. This is my current approach:
NSMutableAttributedString *versionString = [[NSMutableAttributedString alloc]
initWithString:myString];
[versionString addAttribute:NSForegroundColorAttributeName
value:[NSColor redColor] range:NSMakeRange(0, 3)];
NSTableCellView result = [outlineView makeViewWithIdentifier:@"DataCell"
owner:self];
result.textField.allowsEditingTextAttributes = YES;
result.textField.attributedStringValue = versionString;
Is it not possible to render attributed strings in a NSOutlineView and a standard NSTextField?
Upvotes: 2
Views: 623
Reputation: 40211
Okay, the problem was that the outline view highlight style was Source. Setting that to Regular or None will allow attributed strings.
Upvotes: 8