Core Graphics

画圆

1
2
3
var path = UIBezierPath(ovalInRect: rect)
fillColor.setFill()
path.fill()

创建path

1
var plusPath = UIBezierPath()

创建扇形

1
2
3
4
5
6
7
8
9
10
11
12
13
//2 - draw the outer arc
var outlinePath = UIBezierPath(arcCenter: center,
radius: bounds.width/2 - 2.5,
startAngle: startAngle,
endAngle: outlineEndAngle,
clockwise: true)
 
//3 - draw the inner arc
outlinePath.addArcWithCenter(center,
radius: bounds.width/2 - arcWidth + 2.5,
startAngle: outlineEndAngle,
endAngle: startAngle,
clockwise: false)

角度
顺时针 3点钟是0°角