NSTableViewで強調表示せずに太字の行選択スタイルを作成しようとしています
ハイライトをオフに切り替えました:
[myTable setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone];
ただし、選択した行のテキストを太字にするのに問題があります。私が提案したように、NSTableViewのソースのプロパティを変更する必要があります。
- (void) tableViewSelectionDidChange: (NSNotification *) notification
{
NSDictionary *boldFont = [NSDictionary dictionaryWithObject:[NSFont boldSystemFontOfSize:13.0]
forKey:NSFontAttributeName];
NSDictionary *normalFont = [NSDictionary dictionaryWithObject:[NSFont systemFontOfSize:13.0]
forKey:NSFontAttributeName];
for(MyClass *obj in tableSourceList)
obj.name = [[NSMutableAttributedString alloc]
initWithString:obj.name
attributes: normalFont];
long row = [myTable selectedRow];
MyClass objectAtSelectedRow = [tableSourceList objectAtIndex: row];
objectAtSelectedRow.name = [[NSMutableAttributedString alloc]
initWithString:dr.dreamname
attributes: boldFont];
[tableSourceList replaceObjectAtIndex:row withObject:objectAtSelectedRow];
}
残念ながら、効果はありません。
選択したときに行のテキストを太字にする方法は?