2
我试图添加一些格式到基于视图的NSOutlineView中的单元格。无论我尝试什么,文本都会以我指定的任何格式呈现。这是我目前的做法:NSAttributedString在基于视图的NSOutlineView呈现为普通字符串?
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;
是不可能在NSOutlineView和标准NSTextField中呈现属性字符串?