首页 > 技术文章 > ios绘图基本图形之圆弧

PJHome 2016-01-22 15:23 原文

 1    // 画圆弧
 2     // 1.获取上下文
 3     CGContextRef ctx = UIGraphicsGetCurrentContext();
 4     // 2.画圆弧
 5     // x/y 圆心
 6     // radius 半径
 7     // startAngle 开始的弧度
 8     // endAngle 结束的弧度
 9     // clockwise 画圆弧的方向 (0 顺时针, 1 逆时针)
10     //    CGContextAddArc(ctx, 100, 100, 50, -M_PI_2, M_PI_2, 0);
11     CGContextAddArc(ctx, 100, 100, 50, M_PI_2, M_PI, 0);
12     CGContextClosePath(ctx);
13     
14     // 3.渲染
15     //     CGContextStrokePath(ctx);
16     CGContextFillPath(ctx);

 

推荐阅读