我設法創建圓角,但我有與第一圓角麻煩(右下)如何將圓角添加到UIBezierPath自定義矩形?
問:
- 我可以的(moveToPoint)前加一個(addArcWithCenter)方法方法 ?
- 我該如何擺脫矩形開頭的直線(右下角)?
這裏是我的自定義的矩形和一個屏幕截圖代碼:
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: 300, y: 0))
path.addArcWithCenter(CGPoint(x: 300-10, y: 50), radius: 10 , startAngle: 0 , endAngle: CGFloat(M_PI/2) , clockwise: true) //1st rounded corner
path.addArcWithCenter(CGPoint(x: 200, y: 50), radius:10, startAngle: CGFloat(2 * M_PI/3), endAngle:CGFloat(M_PI) , clockwise: true)// 2rd rounded corner
path.addArcWithCenter(CGPoint(x: 200, y: 10), radius:10, startAngle: CGFloat(M_PI), endAngle:CGFloat(3 * M_PI/2), clockwise: true)// 3rd rounded corner
// little triangle at the bottom
path.addLineToPoint(CGPoint(x:240 , y:0))
path.addLineToPoint(CGPoint(x: 245, y: -10))
path.addLineToPoint(CGPoint(x:250, y: 0))
path.addArcWithCenter(CGPoint(x: 290, y: 10), radius: 10, startAngle: CGFloat(3 * M_PI/2), endAngle: CGFloat(2 * M_PI), clockwise: true)
path.closePath()
那麼什麼是休息你實際上得到同樣的效果。 – NSDeveloper