Reputation: 4400
In my custom NSTableCellView I override -(void)drawRect
this way (I do this because I have pattern image background of NSWindow
. I need to show only NSLabel
in cellView):
- (void)drawRect:(NSRect)dirtyRect
{
[[NSColor clearColor] setFill];
NSRectFill(dirtyRect);
[super drawRect:dirtyRect];
}
and I get this result, it makes whole NSWindow
transparent:
I want result like VOX mac app do (Look at red eclipse, you see cellView is transparent with parent background image):
Upvotes: 2
Views: 1606
Reputation: 4400
I've solved my problem:
I used MMScroller library (please read it's setup process), with some tricks in xcode:
I checked off Alternating Rows in tableView Attributes Instector. Then, just setting tableView background color to clearColor in Attributes Inspector did the job.
Upvotes: 2
Reputation: 15015
Well there are two ways you can change the color of cell. 1) Implement delegate:-
- (void)tableView:(NSTableView *)tableView
willDisplayCell:(id)cell
forTableColumn:(NSTableColumn
*)tableColumn
row:(NSInteger)row
And then on the basis of that exract cell value and use setBackgroundColor
api.
2) second ways you can use preparecellcolumn
api of tableview which will return cell value and then set backgroundcolor
.
Upvotes: 0