Reputation: 127
I write this code :
let leftUpPath = UIBezierPath()
leftUpPath.move(to: CGPoint(x: 40, y: 40))
leftUpPath.addArc(withCenter: CGPoint(x: 40, y: 40),
radius: 10,
startAngle: CGFloat(Double.pi),
endAngle: CGFloat(3*Double.pi),
clockwise: true)
leftUpPath.addLine(to: CGPoint(x: 30, y: 50))
leftUpPath.addLine(to: CGPoint(x: 90, y: 50))
leftUpPath.addLine(to: CGPoint(x: 80, y: 30))
leftUpPath.addLine(to: CGPoint(x: 40, y: 30))
and this show me this in my storyboard:
but I want this :
If anyone have the solution, I think my trouble is where I draw the Arc... Thanks for your help
Upvotes: 0
Views: 92
Reputation: 318774
The first point and the arc were incorrect. You need:
let leftUpPath = UIBezierPath()
leftUpPath.move(to: CGPoint(x: 40, y: 30))
leftUpPath.addArc(withCenter: CGPoint(x: 40, y: 40),
radius: 10,
startAngle: .pi * 3 / 2,
endAngle: .pi,
clockwise: false)
leftUpPath.addLine(to: CGPoint(x: 30, y: 50))
leftUpPath.addLine(to: CGPoint(x: 90, y: 50))
leftUpPath.addLine(to: CGPoint(x: 80, y: 30))
leftUpPath.addLine(to: CGPoint(x: 40, y: 30))
Upvotes: 1