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

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 绘制曲线.矩形.圆角矩形.椭圆)