问题
I'm trying to draw a circle using UIBezierPath(ovalInRect: CGRectMake())
. Then I'll change the strokeEnd
property. When this happens, either end of the circular line have sharp corners. Is there any way to round out these corners?
(I would like to make the beginning and end of this line curved)
回答1:
Assuming you are using a CAShapeLayer
to draw this, just set the lineCap
, e.g.:
layer.lineCap = .round
回答2:
For drawRect based solutions use lineCapStyle
let path = UIBezierPath(...)
path.lineCapStyle = .round
来源:https://stackoverflow.com/questions/34373781/rounding-the-edges-of-a-stroke-in-bezier-path-circle-in-swift