【发布时间】:2015-04-26 23:40:51
【问题描述】:
我正在重写 drawRect 方法以绘制椭圆
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, [UIColor mainColorYellow].CGColor);
CGRect rectangle = CGRectMake(0.0, 2.0, rect.size.width , rect.size.height - 4.0);
CGContextAddEllipseInRect(context, rectangle);
CGContextStrokePath(context);
}
如何更改椭圆的填充颜色?我尝试使用 CGContextSetFillColorWithColor(CGContextRef c, CGColorRef color) 但没有结果。
【问题讨论】:
-
你只是在抚摸路径。你需要填写它。
标签: ios core-graphics