Commit 0e862bb79703ad1321c7e46ad447805004a2d135

Authored by daifengyi
1 parent cd95b0a4

feat:step circle UI

HDFwear/Basic/View/StepCircleView.swift
... ... @@ -48,6 +48,7 @@ class StepCircleView: UIView {
48 48 bgLayer.fillColor = nil
49 49 bgLayer.strokeColor = LineColor.cgColor
50 50 bgLayer.lineWidth = 10
  51 + bgLayer.lineCap = .round
51 52 layer.addSublayer(bgLayer)
52 53  
53 54 // 边框全白,边框宽度为 4
... ... @@ -59,9 +60,9 @@ class StepCircleView: UIView {
59 60  
60 61  
61 62 let radius = bounds.height / 2 - 5
62   - let end = CGFloat(Double.pi * 2) - CGFloat(Double.pi / 2)
  63 + let end = CGFloat(Double.pi * 2) + CGFloat(Double.pi / 2 * 0.3)
63 64 bgLayer.path = UIBezierPath(arcCenter: CGPoint(rect: bounds), radius: radius,
64   - startAngle: -CGFloat(Double.pi / 2), endAngle: end,
  65 + startAngle: CGFloat(Double.pi / 2 * 1.7), endAngle: end,
65 66 clockwise: true).cgPath
66 67  
67 68 // = progressPath.cgPath
... ... @@ -70,7 +71,7 @@ class StepCircleView: UIView {
70 71 // 设置为 顺时针 方向
71 72  
72 73 let progressPath = UIBezierPath(arcCenter: CGPoint(rect: bounds), radius: radius,
73   - startAngle: -CGFloat(Double.pi / 2), endAngle: end,
  74 + startAngle: CGFloat(Double.pi / 2 * 1.7), endAngle: end,
74 75 clockwise: true)
75 76 progressLayer.lineCap = .round
76 77 progressLayer.path = progressPath.cgPath
... ...