How do I go about drawing my own custom selection style for a view based NSTableView
? I tried putting a BOOL
var in my NSTableCellView
To make things clear, I think we should give the code of the delegate method :
- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
{
MyNSTableRowView *rowView = [[MyNSTableRowView alloc]init];
return rowView;
}
Alright, I figured it out. You just have to subclass NSTableRowView
. It has methods for drawing the background for selected and deselected rows. To get the table view to use your subclass just implement the table view delegate method tableView:rowViewForRow:
and return an instance of your subclass.