Search code examples
macoscocoanstableviewnstablecellview

NSTableCellView transparent background


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


Solution

  • 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