如何使用UIBezierPath制作曲线?
答
初始化路径。
UIBezierPath *aPath = [UIBezierPath bezierPath];
CGFloat xPos = 100.0;
CGFloat yPos = 50.0;
CGFloat width = 200;
CGFloat height = 200;
CGPoint controlPoint = CGPointMake(10.0, 10.0);
// Set the starting point of the shape.
[aPath moveToPoint:CGPointMake(xPos, yPos)];
[aPath moveToPoint:CGPointMake(xPos, width)];
// Draw the lines.
[aPath addLineToPoint:CGPointMake(width, height)];
//Add your arc here
[aPath addCurveToPoint:CGPointMake(xPos, height) controlPoint1:controlPoint controlPoint2:CGPointZero]
[aPath addLineToPoint:CGPointMake(xPos, yPos)];
//Close the Path
[aPath closePath];
尝试上面的代码。这不是测试的代码,我不在我的系统。通过调整控制点,可以增加弧的半径。
有趣的问题。你有尝试过什么吗? – CivFan
@CivFan我尝试了很多,但没有成功。我试图使用UIBezier路径的弧方法。 – milanpanchal