我想在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