From 0e862bb79703ad1321c7e46ad447805004a2d135 Mon Sep 17 00:00:00 2001 From: daifengyi Date: Sat, 20 May 2023 08:57:36 +0800 Subject: [PATCH] feat:step circle UI --- HDFwear/Basic/View/StepCircleView.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HDFwear/Basic/View/StepCircleView.swift b/HDFwear/Basic/View/StepCircleView.swift index 443d4f6..606e47e 100644 --- a/HDFwear/Basic/View/StepCircleView.swift +++ b/HDFwear/Basic/View/StepCircleView.swift @@ -48,6 +48,7 @@ class StepCircleView: UIView { bgLayer.fillColor = nil bgLayer.strokeColor = LineColor.cgColor bgLayer.lineWidth = 10 + bgLayer.lineCap = .round layer.addSublayer(bgLayer) // 边框全白,边框宽度为 4 @@ -59,9 +60,9 @@ class StepCircleView: UIView { let radius = bounds.height / 2 - 5 - let end = CGFloat(Double.pi * 2) - CGFloat(Double.pi / 2) + let end = CGFloat(Double.pi * 2) + CGFloat(Double.pi / 2 * 0.3) bgLayer.path = UIBezierPath(arcCenter: CGPoint(rect: bounds), radius: radius, - startAngle: -CGFloat(Double.pi / 2), endAngle: end, + startAngle: CGFloat(Double.pi / 2 * 1.7), endAngle: end, clockwise: true).cgPath // = progressPath.cgPath @@ -70,7 +71,7 @@ class StepCircleView: UIView { // 设置为 顺时针 方向 let progressPath = UIBezierPath(arcCenter: CGPoint(rect: bounds), radius: radius, - startAngle: -CGFloat(Double.pi / 2), endAngle: end, + startAngle: CGFloat(Double.pi / 2 * 1.7), endAngle: end, clockwise: true) progressLayer.lineCap = .round progressLayer.path = progressPath.cgPath -- libgit2 0.21.4