Quartz2D - 基本图形绘制(形状)
2016-03-06 16:00
429 查看
1.空心圆圈
2.实心圆
3.圆弧
4.扇形
// 创建 UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(20, 20, 200, 200) cornerRadius:100]; // 设置属性 path.lineWidth = 5; path.lineCapStyle = kCGLineCapRound; path.lineJoinStyle = kCGLineJoinRound; [[UIColor redColor] set]; // 绘制 [path stroke];
2.实心圆
// 创建 UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(20, 20, 200, 200) cornerRadius:100]; // 设置属性 path.lineWidth = 5; path.lineCapStyle = kCGLineCapRound; path.lineJoinStyle = kCGLineJoinRound; [[UIColor redColor] set]; // 填充(必须是一个完整的封闭路径) [path fill];
3.圆弧
/* center:圆心 startAngle: 弧度 clockwise:YES顺时针/NO逆时针 */ UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(150, 150) radius:100 startAngle:0 endAngle:-M_PI_2 clockwise:NO]; path.lineWidth = 5; [[UIColor orangeColor] set]; [path stroke];
4.扇形
// 扇形 CGPoint center = CGPointMake(150, 150); UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:100 startAngle:0 endAngle:-M_PI_2 clockwise:NO]; // 添加一根线到圆心 [path addLineToPoint:center]; // 关闭路径(从路径的终点到起点) [path closePath]; path.lineWidth = 5; [[UIColor redColor] set]; [path fill];
相关文章推荐
- 树莓派 raspberry 入门之安装操作系统以及配置
- Ubuntu14.04+CUDA7.5+Docker+Caffe
- linux内核分析作业:操作系统是如何工作的进行:完成一个简单的时间片轮转多道程序内核代码
- 淘宝网店加盟之美人计篇
- 使用免费的产品搭建直播系统
- bzoj2535: [Noi2010]Plane 航空管制
- UIActivityViewController头文件学习
- CodeForces - 621B Wet Shark and Bishops (数学几何&技巧)
- 一般运行时间
- hdu2196
- 2809: [Apio2012]dispatching|splay启发式合并
- postgresql主备之the database system is starting up
- 构建ASP.NET MVC5+EF6+EasyUI 1.4.3+Unity4.x注入的后台管理系统(57)-插件---ueditor使用
- 算法题目一:如果数组中数字重复最多的次数大于数组长度的一半,返回1,否则返回0
- n-1 个数中三个数乘积最大的最小公倍数
- sqlite3 笔记整理
- VS2015快捷键设置
- ZooKeeper架构及简介
- DeepLearning--Part3--Chapter16:Representation Learning(1) categories:
- 51nod 1347 旋转字符串