Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circular slider step value #70

Open
antondityativ opened this issue Jul 23, 2020 · 2 comments
Open

circular slider step value #70

antondityativ opened this issue Jul 23, 2020 · 2 comments

Comments

@antondityativ
Copy link

Hi! Could you tell me how can I set a step value for the circular slider? Thank you very much!

@antondityativ
Copy link
Author

@HamzaGhazouani could you help me?

@oddukgi
Copy link

oddukgi commented Aug 18, 2020

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)   
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants