我只想使用以下函数为视图绘制一个简单的矩形:
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
if (self.drawTextBouble) {
[[UIColor blueColor] setFill];
UIBezierPath *aPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(40, 0, 230, 120) cornerRadius:12.0];
[aPath fill];
}
}
上面的代码用纯黑色背景填充视图,矩形外不透明。我怎样才能解决这个问题?
编辑:
下面的解决方案有效,但这也有效:
[self setOpaque:NO];