Search code examples
macosxcode4transparencynstableview

How to make NSTableView transparent?


I want to make transparent NSTableView.
I am using WindowController class here.
I was trying this:

- (void)windowDidLoad
{
     [super windowDidLoad];
     [[self enclosingScrollView] setDrawsBackground: NO];
     [[self enclosingScrollView] setBorderType:NSNoBorder];

}

- (BOOL)isOpaque {

      return NO;
} 
- (void)drawRect:(NSRect)drawRect
{
     [super drawRect: drawRect];
}

But when i was writing this code i can't found enclosingScrollView in help window.
you can see here..

enter image description here

Any help?? Please remember me or correct me if i am doing something wrong.
Thank you.


Solution

  • Got Answer..!!! I just tried this

    [tableview setBackgroundColor:[NSColor clearColor]]; 
    [tableview setHeaderView:nil]; 
    

    and its working fine.. – – Snehal

    Copied from comment in question, as its a bit buried...