首页 > 移动平台 > 详细

ios绘图基本图形之三角形

时间:2016-01-22 17:53:37      阅读:141      评论:0      收藏:0      [点我收藏+]
 1     // 1.获取图形上下文
 2     CGContextRef ctx =  UIGraphicsGetCurrentContext();
 3     
 4     // 2. 绘制三角形
 5     // 设置起点
 6     CGContextMoveToPoint(ctx, 100, 10);
 7     // 设置第二个点
 8     CGContextAddLineToPoint(ctx, 50, 100);
 9     // 设置第三个点
10     CGContextAddLineToPoint(ctx, 150, 100);
11     // 设置终点
12     //    CGContextAddLineToPoint(ctx, 100, 10);
13     // 关闭起点和终点
14     CGContextClosePath(ctx);
15     // 3.渲染图形到layer上
16     CGContextStrokePath(ctx);

 

ios绘图基本图形之三角形

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

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