/**
* 画圆
*/
- (void)drawRect:(CGRect)rect {
//1.获得图形上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
//2.画圆
CGContextAddEllipseInRect(ctx, CGRectMake(50, 10, 100, 100));
CGContextSetLineWidth(ctx, 10);
//3.渲染显示到view上
CGContextStrokePath(ctx);
// CGContextFillPath(ctx);
}
/**
* 画圆弧
*/
- (void)drawRect:(CGRect)rect {
//1.获得图形上下文
CGContextRef ctx = UIGraphicsGetCurrentContext();
//2.画圆弧
CGContextAddArc(ctx, 100, 100, 50, M_PI_2, M_PI, 0);
CGContextSetLineWidth(ctx, 10);
//3.渲染显示到view上
CGContextStrokePath(ctx);
}