我想在CG中獲得透明背景,但它始終呈現黑色。CoreGraphics中的透明背景
我有以下代碼:
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
DLog(@">>> Alloc: DrawingCanvas [0x%X]", (unsigned int)self);
[self setOpaque:NO];
[self setBackgroundColor:[UIColor clearColor]];
}
return self;
}
- (void) drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect frame = rect;
int counter = 3;
CGContextClearRect(context, frame);
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
CGContextFillRect(context, frame);
}
我如何獲得此代碼顯示一個透明的背景是什麼?
您是否找到解決方案?如果是這樣,請通過回答您自己的問題分享。 – 2011-04-22 18:44:41