change the shape of UIButton

Asked 1 years ago, Updated 1 years ago, 61 views

I tried to transform UIButton into a fan, and I tried to draw a fan using UIBezierPath, but I didn't know how to put the formula together, so I'm asking you a question.
If you know how to do it, please let me know.
Thank you for your cooperation.

swift xcode

2022-09-30 20:35

1 Answers

Is this the right fan type?

let bezierPath=UIBezierPath()
bezierPath.moveToPoint (CGPointMake(0,20))
bezierPath.addCurveToPoint (CGPointMake(40,0), controlPoint1: CGPointMake(0,20), controlPoint2: CGPointMake(11,0))
bezierPath.addCurveToPoint (CGPointMake(80,20), controlPoint1: CGPointMake(69,0), controlPoint2: CGPointMake(80,20))
bezierPath.addLineToPoint (CGPointMake (40,56))
bezierPath.addLineToPoint (CGPointMake(0,20))
bezierPath.closePath()
UIColor.grayColor().setFill()
bezierPath.fill()

fan type


2022-09-30 20:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.