You need to subclass NSTableHeaderCell
instead. This code results in transparent header in my test:
- (void)drawWithFrame:(CGRect)cellFrame inView:(NSView *)view
{
[self drawInteriorWithFrame:cellFrame inView:view];
}
Question
I would like to create a custom NSTableHeaderView
which works well on a black HUD window. I created a subclass of NSTableHeaderView
which created this result:
I do no drawing at all. This is the relevant code:
- (void)drawRect:(NSRect)dirtyRect
{
[NSGraphicsContext saveGraphicsState];
// no background drawing, just draw the text.
[NSGraphicsContext restoreGraphicsState];
}
- (BOOL)isOpaque
{
return NO;
}
How can I get a transparent background?
Solution
You need to subclass NSTableHeaderCell
instead. This code results in transparent header in my test:
- (void)drawWithFrame:(CGRect)cellFrame inView:(NSView *)view
{
[self drawInteriorWithFrame:cellFrame inView:view];
}