Sometimes, we want to set the NSView's background color to clear color, and you maybe use the code: php
- (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; NSColor *bgColor = [NSColor clearColor]; [bgColor set]; }
if you do like this, the background will be black,not clear,so how to do it? html
The way is you don't need to use the drawRect: method,just need to call the method: this
- (BOOL)isOpaque { retuen YES;// or NO }
Reference:http://www.cocoachina.com/bbs/read.php?tid=85775 spa
http://www.cocoachina.com/bbs/read.php?tid-45122.html code
Thanks, htm
Blues get