Search code examples
iosiphoneswiftxcodeuibezierpath

UIBezierPath visual error?


I am drawing a shape with a UIBezierPath and I have a problem with my Arc, I am showing you my code:

...
rightUpPath.move(to: CGPoint(x: 0, y: height/2))
    rightUpPath.addArc(withCenter: CGPoint(x: cornerRadiusView, y: height - cornerRadiusView),
                   radius: cornerRadiusView,
                   startAngle: .pi,
                   endAngle: (.pi * 2) / 3,
                   clockwise: false)
    rightUpPath.addLine(to: CGPoint(x: self.bounds.size.width - cornerRadiusView, y: height))
...

Considering that height was equal to 40, cornerRadiusView = 10. The bottom of the Arc is normally equal to the bottom of the shape but this show me this :

enter image description here

I want that the bottom of the arc is equal to the height of the gray shape, can somebody tell me where I am doing wrong?


Solution

  • Ok my problem was very stupid:

    I change my endAngle: (.pi * 2) / 3 to endAngle: .pi / 2

    ...