ios 画圆

画圆:

- (void)drawRect:(CGRect)rect {
    UIBezierPath *path = [UIBezierPath bezierPath];
    //clockwise 为YES顺时针  为NO逆时针
    [path addArcWithCenter:CGPointMake(100, 100) radius:80 startAngle:M_PI_2 * 3 endAngle:0 clockwise:YES];
    [path addLineToPoint:CGPointMake(100, 100)];
    [path closePath];
    
    //移动画笔
//    [path moveToPoint:CGPointMake(100, 180)];
//    [path addArcWithCenter:CGPointMake(100, 100) radius:80 startAngle:M_PI_2 endAngle:M_PI clockwise:YES];
//    [path addLineToPoint:CGPointMake(100, 100)];
//    [path closePath];


    path.lineWidth = 8;
    [[UIColor redColor] setStroke];
    [path stroke];
    [[UIColor greenColor] setFill];
    [path fill];
}
posted @ 2017-08-23 21:19  笑笑就好90  阅读(103)  评论(0编辑  收藏  举报