ビューからこのメソッドを削除すると、すべてが正常に機能する (ボタンをクリックしてもコンテンツが消えない) ため、間違いなくこれが原因です。
以下のコードを使用して、丸みを帯びたグラデーションのあるウィンドウを作成しようとしています。ビューのコンテンツが消える原因となるような問題はありますか?
- (void)drawRect:(NSRect)dirtyRect
{
[NSGraphicsContext saveGraphicsState];
NSBezierPath *outerClip = [NSBezierPath bezierPathWithRoundedRect:[self bounds]
xRadius:3.0
yRadius:3.0];
[outerClip setClip];
NSGradient* aGradient = [[NSGradient alloc]
initWithStartingColor:[NSColor colorWithCalibratedWhite:1.0 alpha:1.0]
endingColor:[NSColor colorWithCalibratedWhite:0.65 alpha:1.0]];
[aGradient drawInRect:[outerClip bounds] angle:270];
[NSGraphicsContext restoreGraphicsState];
}