2
votes

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:

enter image description here

I want result like VOX mac app do (Look at red eclipse, you see cellView is transparent with parent background image):

enter image description here

2

2 Answers

2
votes

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.

enter image description here

0
votes

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.