我想创建一个在黑色HUD窗口上运行良好的自定义NSTableHeaderView
。我创建了一个NSTableHeaderView
的子类,它创建了这个结果:
我根本没画画。这是相关的代码:
- (void)drawRect:(NSRect)dirtyRect
{
[NSGraphicsContext saveGraphicsState];
// no background drawing, just draw the text.
[NSGraphicsContext restoreGraphicsState];
}
- (BOOL)isOpaque
{
return NO;
}
如何获得透明背景?
答案 0 :(得分:0)
您需要改为NSTableHeaderCell
的子类。此代码在我的测试中生成透明标题:
- (void)drawWithFrame:(CGRect)cellFrame inView:(NSView *)view
{
[self drawInteriorWithFrame:cellFrame inView:view];
}