/**
绘图步骤
1. 获得上下文 Ref => UIGraphicsGetCurrentContext
2. 设置绘图路径(贝塞尔路径是UIKit封装的) UIBezierPath
3. 将路径添加到上下文 CGContextAddPath(ctx, path.CGPath);
4. 让上下文绘制路径 CGContextDrawPath(ctx, kCGPathStroke);
*/
//获得图形上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
设置绘图路径(贝塞尔路径是UIKit封装的)
//画圆
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(40, 60, 40, 40)];
//画矩形
UIBezierPath *path1 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(80, 180, 120, 60) cornerRadius:10.0];
//画线
// 2. 贝塞尔路径
UIBezierPath *path = [UIBezierPath bezierPath];
// 2.1 设置起点
[path moveToPoint:CGPointMake(10, 10)];
// 2.2 画线
[path addLineToPoint:CGPointMake(140, 120)];
[path addLineToPoint:CGPointMake(270, 10)];
// 关闭路径,从最后一个点,连接到起点,产生一条封闭的路径
[path closePath];