UIBezierPath貝塞爾弧線經常使用方法記

//根據一個矩形畫曲線spa

+ (UIBezierPath *)bezierPathWithRect:(CGRect)rectorm


//根據矩形框的內切圓畫曲線it

+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rectmargin


//根據矩形畫帶圓角的曲線top

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadiusword


//在矩形中,能夠針對四角中的某個角加圓角di

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadiico

參數:枚舉

corners:枚舉值,能夠選擇某個角參數

cornerRadii:圓角的大小

//以某個中心點畫弧線

+ (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise;

參數:

center:弧線中心點的座標

radius:弧線所在圓的半徑

startAngle:弧線開始的角度值

endAngle:弧線結束的角度值

clockwise:是否順時針畫弧線


//畫二元曲線,通常和moveToPoint配合使用

- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint

參數:

endPoint:曲線的終點

controlPoint:畫曲線的基準點


//以三個點畫一段曲線,通常和moveToPoint配合使用

- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2

參數:

endPoint:曲線的終點

controlPoint1:畫曲線的第一個基準點

controlPoint2:畫曲線的第二個基準點

相關文章
相關標籤/搜索