ios 貝茲路徑方法解釋

來源:互聯網
上載者:User

標籤:

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 貝茲路徑方法解釋

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.