MatiBot / MBCircularProgressBar

A circular, animatable & highly customizable progress bar from the Interface Builder (Objective-C)
https://www.cocoacontrols.com/controls/mbcircularprogressbar
MIT License
994 stars 180 forks source link

Set Direction for MBCircularProgressBar: clockwise or counter clockwise #92

Open HoLuong1609 opened 2 years ago

HoLuong1609 commented 2 years ago

I want to set counter clockwise direction for MBCircularProgressBar. Is this possible with the library

HoLuong1609 commented 2 years ago

I have tried and encounter to a solution:

import MBCircularProgressBar

class DirectionCircularProgressBarView: MBCircularProgressBarView {

private var clockwiseDirection:Bool = true

func  setClockwiseDirection(_value: Bool) {
    clockwiseDirection = _value
    if (!clockwiseDirection) {
        let color = progressColor
        progressColor = emptyLineColor
        emptyLineColor = color
    }
}

func setValue(value: CGFloat) {
    if clockwiseDirection {
        self.value = value
    } else {
        self.value = -value
    }
}

}

And then you should call setValue(?) instead of call .value = ?