Created
June 6, 2016 03:01
-
-
Save cumanzor/89f4fdd1fa77a84ec4627bb5a9c67e40 to your computer and use it in GitHub Desktop.
stepped UISlider.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let step: Float = 50; | |
// extra slider initialization. the IBAction func below points to the UISlider we are using. | |
@IBAction func onStrengthChange(sender: UISlider) { | |
let roundedValue = round(sender.value/step) * step | |
sender.value = roundedValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://candycode.io/uislider-with-steps-snapping-to-values-in-swift/