circular slider step value
antondityativ opened this issue · comments
antondityativ commented
Hi! Could you tell me how can I set a step value for the circular slider? Thank you very much!
antondityativ commented
@HamzaGhazouani could you help me?
Sunmi Kang commented
It's simple to change value.
Value change adding 10
circularSlider.addTarget(self, action: #selector(updateTexts), for: .valueChanged)
@objc func updateTexts() {
let step: CGFloat = 10
let roundedValue = round(circularSlider.endPointValue / step) * step
let value = roundedValue
// same as example code
let ok = (circularSlider.maximumValue / CGFloat(circularSlider.numberOfRounds))
let ff = ceil(value / ok)
maxValueLabel.text = String(format: "%.0f", circularSlider.maximumValue)
minValueLabel.text = String(format: "%.0f", circularSlider.minimumValue)
currentValueLabel.text = String(format: "%.0f", value)
roundsLabel.text = "Round N° " + String(format: "%.0f", ff)
}