效果图:
基本原理[图来自官方文档]:
当前点[current point]、控制点[control point]和结束点[endPoint]之间的关系定义了实际的曲线。
函数代码实例:
#pragma mark画二次贝塞尔曲线
-(void)secondBeziePathDraw
{
UIBezierPath*path=[UIBezierPathbezierPath];
//起点[左侧]
[pathmoveToPoint:CGPointMake(20,self.frame.size.height-100)];
//二次曲线
[pathaddQuadCurveToPoint:CGPointMake(self.frame.size.width-30,self.frame.size.height-100)controlPoint:CGPointMake(self.frame.size.width/2,self.frame.size.height-10)];
path.lineWidth=8;
UIColor*sColor=[UIColorredColor];
[sColorset];
[pathstroke];
}