File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99import UIKit
1010
11+ @objc ( KFGradientProgressView)
1112open class GradientProgressView : UIView {
1213
1314 //进度条完成部分的渐变颜色,设置单个为纯色,设置多个为渐变色
15+ @objc
1416 public var progressColors : [ UIColor ] = [ . systemBlue] {
1517 didSet {
1618 if progressColors. count == 0 {
@@ -25,20 +27,23 @@ open class GradientProgressView: UIView {
2527 }
2628
2729 //进度条完成部分的圆角半径
30+ @objc
2831 public var progressCornerRadius : CGFloat = 0 {
2932 didSet {
3033 maskLayer. cornerRadius = progressCornerRadius
3134 }
3235 }
3336
3437 //进度完成部分的内间距
38+ @objc
3539 public var progressEdgeInsets : UIEdgeInsets = . zero {
3640 didSet {
3741 setNeedsLayout ( )
3842 }
3943 }
4044
4145 //当前进度
46+ @objc
4247 public var progress : Float {
4348 get {
4449 return privateProgress
@@ -59,12 +64,15 @@ open class GradientProgressView: UIView {
5964 } ( )
6065
6166 //动画持续时间
67+ @objc
6268 public var animationDuration : TimeInterval = 0.3
6369
6470 //动画时间函数
71+ @objc
6572 public var timingFunction : CAMediaTimingFunction = CAMediaTimingFunction ( name: . default)
6673
6774 //进度更新动画过程中的回调,在这里可以拿到当前进度及进度条的frame
75+ @objc
6876 public var progressUpdating : ( ( Float , CGRect ) -> ( ) ) ?
6977
7078
@@ -113,6 +121,7 @@ open class GradientProgressView: UIView {
113121 }
114122
115123 // MARK: - Public
124+ @objc ( setProgress: animated: )
116125 public func setProgress( _ progress: Float , animated: Bool ) {
117126 let validProgress = min ( 1.0 , max ( 0.0 , progress) )
118127 if privateProgress == validProgress {
You can’t perform that action at this time.
0 commit comments