我设法创建圆角,但我有与第一圆角麻烦(右下)如何将圆角添加到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