標籤:
1、根據一個矩形畫曲線
+ (UIBezierPath *)bezierPathWithRect:(CGRect)rect
2、根據矩形框的內切圓畫曲線
+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect
3、根據矩形畫帶圓角的曲線
+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius
4、在矩形中,可以針對四角中的某個角加圓角, 一般用於設定某個視圖的頂端兩角為圓形
+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii
參數:
corners:枚舉值,可以選擇某個角
cornerRadii:圓角的大小
5、以某個中心點畫弧線 + (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise;
參數:
center:弧線中心點的座標
radius:弧線所在圓的半徑
startAngle:弧線開始的角度值
endAngle:弧線結束的角度值
clockwise:是否順時針畫弧線
6、畫二元曲線,一般和moveToPoint配合使用
- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint
參數:
endPoint:曲線的終點
controlPoint:畫曲線的基準點
7、以三個點畫一段曲線,一般和moveToPoint配合使用
- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2
參數:
endPoint:曲線的終點
controlPoint1:畫曲線的第一個基準點
controlPoint2:畫曲線的第二個基準點
ios 貝茲路徑方法解釋