【发布时间】:2013-03-31 17:09:19
【问题描述】:
我正在尝试在 UIView 中绘制一个简单的圆圈。我知道我可以使用 QuartzCore 做到这一点,但我想使用 drawRect 方法:
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextAddEllipseInRect(ctx, rect);
CGContextSetFillColor(ctx, CGColorGetComponents([[UIColor greenColor] CGColor]));
CGContextFillPath(ctx);
}
当我设置[UIColor whiteColor] 时,上面的代码不起作用。当[UIColor whiteColor] 时,视图将变得透明..
为什么当颜色为白色时视图变得透明?我怎样才能画一个白色的圆圈?
【问题讨论】:
标签: iphone ios cocoa-touch