美文网首页iOS Developer
IOS 绘制曲线.矩形.圆角矩形.椭圆

IOS 绘制曲线.矩形.圆角矩形.椭圆

作者: JakieZhang | 来源:发表于2016-12-21 09:54 被阅读966次

    UIBezierPath*path = [UIBezierPathbezierPath];

    [pathmoveToPoint:CGPointMake(150,50)];

    [pathaddCurveToPoint:CGPointMake(50,150)controlPoint1:CGPointMake(50,50)controlPoint2:CGPointMake(150,150)];

    [pathaddCurveToPoint:CGPointMake(150,250)controlPoint1:CGPointMake(150,150)controlPoint2:CGPointMake(50,250)];

    [[UIColorredColor]setStroke];

    [pathstroke];

    //绘制矩形

    UIBezierPath*path2 = [UIBezierPathbezierPathWithRect:CGRectMake(20,300,200,15)];

    path2.lineWidth=4;

    [[UIColorblueColor]setStroke];

    [path2stroke];

    //绘制圆角矩形

    UIBezierPath*path3 = [UIBezierPathbezierPathWithRoundedRect:CGRectMake(20,330,200,150)cornerRadius:75];

    [path3stroke];

    //绘制椭圆

    UIBezierPath*path4 = [UIBezierPathbezierPathWithOvalInRect:CGRectMake(20,330,200,150)];

    [[UIColorgreenColor]setFill];

    [path4fill];

    相关文章

      网友评论

        本文标题:IOS 绘制曲线.矩形.圆角矩形.椭圆

        本文链接:https://www.haomeiwen.com/subject/tmfqvttx.html