(新しいiTunesで)次のようなものを作りたいです:

行が選択されたときにわかるように、「ハイライト」状態は角の丸い行です。
どうすればこのようなことを達成できますか?
(新しいiTunesで)次のようなものを作りたいです:

行が選択されたときにわかるように、「ハイライト」状態は角の丸い行です。
どうすればこのようなことを達成できますか?
NSTableviewメソッドをサブクラス化してオーバーライドする必要があります-highlightSelectionInClipRect:。
次のように実行できます。
Attributes Inspectorで、tableView の強調表示モードを通常からソース リストに変更します。

そして、次のようにサブクラス化NSTableViewします。
-(void)highlightSelectionInClipRect:(NSRect)theClipRect
{
NSRange visibleRowIndexes = [self rowsInRect:theClipRect];
NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
NSUInteger endRow = visibleRowIndexes.location + visibleRowIndexes.length;
NSUInteger row;
for (row=visibleRowIndexes.location; row<endRow; row++)
{
if([selectedRowIndexes containsIndex:row])
{
NSRect rowRect = NSInsetRect([self rectOfRow:row], 3, 4);
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rowRect xRadius:4.0 yRadius:4.0];
[[NSColor colorWithCalibratedRed:0.474 green:0.588 blue:0.743 alpha:1] set];
[path fill];
}
}
}
結果:
