11
A
回答
23
有很多方法可以做到这一点,但一个是刚刚得出两个贝塞尔路径,每侧一个:
- (void)drawRect:(CGRect)rect
{
UIBezierPath *blueHalf = [UIBezierPath bezierPath];
[blueHalf addArcWithCenter:CGPointMake(100, 100) radius:90.0 startAngle:-M_PI_2 endAngle:M_PI_2 clockwise:YES];
[blueHalf setLineWidth:4.0];
[[UIColor blueColor] setStroke];
[blueHalf stroke];
UIBezierPath *redHalf = [UIBezierPath bezierPath];
[redHalf addArcWithCenter:CGPointMake(100, 100) radius:90.0 startAngle:M_PI_2 endAngle:-M_PI_2 clockwise:YES];
[redHalf setLineWidth:4.0];
[[UIColor redColor] setStroke];
[redHalf stroke];
}
或者,如果你想这样做核芯显卡:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 4);
CGContextSetStrokeColorWithColor(context, [[UIColor blueColor] CGColor]);
CGContextAddArc(context, 100, 100, 90, -M_PI_2, M_PI_2, FALSE);
CGContextStrokePath(context);
CGContextSetStrokeColorWithColor(context, [[UIColor redColor] CGColor]);
CGContextAddArc(context, 100, 100, 90, M_PI_2, -M_PI_2, FALSE);
CGContextStrokePath(context);
}
相关问题
- 1. 不完整的UIBezierPath笔画
- 2. HTML5画布 - 不同的笔画
- 3. 在iOS中画圆圈动画用圆形笔画
- 4. 圆形笔画的笔画动画以完整笔画结尾
- 5. UIBezierPath笔画1px线和填充1px宽度的矩形 - 不同的结果。
- 6. 如何动画UIBezierPath
- 7. UIBezierPath脉冲动画
- 8. 画上一个UIBezierPath
- 9. UIBezierPath - 动画填写
- 10. 如何更改UIBezierPath笔画的颜色并设置动画效果?
- 11. 手指画笔中的笔画删除
- 12. c#同时画很多圈
- 13. 保持以前的UIBezierPath笔画在连续调用drawRect
- 14. 动画颜色属性有不同的画笔
- 15. iOS - 只动画UIBezierPath的'appendPath'
- 16. UIView中的UIBezierPath动画
- 17. HTML5画笔笔尖
- 18. 多边形SVG不同笔画
- 19. 用不同颜色撤销笔画
- 20. d3画笔部分更新坐标轴不是圆圈
- 21. 在inkpresenter中动画笔画
- 22. SVG圈动画
- 23. MFC画圈
- 24. .net笔画与笔(不同的颜色)在一个循环中
- 25. jQuery的动画圈
- 26. 画布上画的画笔不起作用
- 27. HTML5画布画圈圈绕一大圈路
- 28. Quake MAP画笔
- 29. 绘制画笔
- 30. HTML5 JavaScript画笔
使用具有不同颜色的“UIBezierPath”绘制两个单独的弧线。 – Exploring
是的,你可以做两个或两个以上的弧线,这取决于你需要的颜色数量。 – CodenameLambda1