UIBezierPath 畫圓弧(角度問題)

2021-07-06 05:26:25 字數 1312 閱讀 8961

uibezierpath通過

- (void)addarcwithcenter:(cgpoint)center radius:(cgfloat)radius startangle:(cgfloat)startangle endangle:(cgfloat)endangle clockwise:(bool)clockwise

可以畫出一段弧線。

看下各個引數的意義:

center:圓心的座標

radius:半徑

startangle:起始的弧度

endangle:圓弧結束的弧度

clockwise:yes為順時針,no為逆時針

方法裡面主要是理解startangle與endangle,剛開始我搞不清楚一段圓弧從哪算起始和終止,比如弧度為0的話,是從上下左右哪個點開始算

.這裡大家應該可以看出弧度是順時針的,知道這個下面就很容易了

UIBezierPath畫圓弧的記錄

uibezierpath通過 void addarcwithcenter cgpoint center radius cgfloat radius startangle cgfloat startangle endangle cgfloat endangle clockwise bool clock...

UIBezierPath畫圓弧的記錄

文中的圖很重要!根據下文,完成了下圖的mask 如下 cgsize size self.size 畫路徑 uibezierpath maskpath uibezierpath bezierpath bottom line maskpath movetopoint cgpointmake size.w...

UIBezierPath畫圓弧的記錄

uibezierpath通過 void addarcwithcenter cgpoint center radius cgfloat radius startangle cgfloat startangle endangle cgfloat endangle clockwise bool clock...