iOS Quartz2D - 画圆和圆弧

来源:互联网 发布:淘宝评论怎么评论内容 编辑:程序博客网 时间:2024/06/10 05:03
/** *  画圆 */- (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);}


0 0