首页 > 移动平台 > 详细

ios绘图基本图形之圆形

时间:2016-01-22 17:19:31      阅读:170      评论:0      收藏:0      [点我收藏+]

 

 1 - (void)drawRect:(CGRect)rect
 2 {
 3 
 4     // 1.获取上下文
 5     CGContextRef ctx = UIGraphicsGetCurrentContext();
 6     // 画圆
 7     CGContextAddArc(ctx, 100, 100, 50, 0, 2 * M_PI, 0);
 8 
 9     // 3.渲染 (注意, 画线只能通过空心来画)
10 //    CGContextFillPath(ctx);
11     CGContextStrokePath(ctx);
12 
13 }

or

 1 - (void)drawRect:(CGRect)rect
 2 {
 3 
 4     // 画圆
 5     // 1.获取上下文
 6     CGContextRef ctx = UIGraphicsGetCurrentContext();
 7     // 2.画圆
 8     CGContextAddEllipseInRect(ctx, CGRectMake(50, 100, 50, 50));
 9     
10     [[UIColor greenColor] set];
11     
12     // 3.渲染
13     //    CGContextStrokePath(ctx);
14     CGContextFillPath(ctx);
15 
16 }

 

ios绘图基本图形之圆形

原文:http://www.cnblogs.com/PJHome/p/5151379.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!