addArc(withCenter) closing path

前端 未结 2 764
既然无缘
既然无缘 2020-12-07 00:28

The following code:

  let size = CGSize(width: 200, height: 30)
  let rect = CGRect(origin: .zero, size: size)

  let path1 = UIBezierPath()
  path1.move(to:         


        
2条回答
  •  無奈伤痛
    2020-12-07 00:39

    Hope this will help you to achieve your result

     let size = CGRect(origin: .zero, size: CGSize(width : 200 , height : 30))
    
            let path = UIBezierPath()
            path.move(to: CGPoint(x: 10, y: 100))
            path.addLine(to: CGPoint(x: 180, y: 100))
            path.addArc(withCenter: CGPoint(x:180 , y: 85), radius: 15, startAngle: (3.14159 / 2), endAngle:  (3 * 3.14159 / 2), clockwise: false)
    
        path.addLine(to: CGPoint(x: 10, y: 70)) //y = radius * 2
    

    Above code will draw this in your canvas .

提交回复
热议问题