I have a Table subclass of NSView which contains several blocks of the Block subclass of NSView. This is the code for Table's drawRect: method:
- (void)drawRect:(NSRect)dirtyRect
{
[NSGraphicsContext saveGraphicsState];
[[[NSColor whiteColor] colorWithAlphaComponent:0.6] set];
[NSBezierPath fillRect:dirtyRect];
[NSGraphicsContext restoreGraphicsState];
}
And this the code of Block's drawRect: method:
-(void)drawRect:(NSRect)dirtyRect
{
[NSGraphicsContext saveGraphicsState];
[color set];
[NSBezierPath fillRect:dirtyRect];
[NSGraphicsContext restoreGraphicsState];
}
where "color" is set to [[NSColor whiteColor] colorWithAlphaComponent:0].
But I don't understand why, when I run the application, evenrything's fine, but each time I click on a Block this gets filled with the classic gray initial background on Mac OS X... can anybody help? I would be very greatful, thanks.