0

I have a slider that have a min of 0 and a max of 8. I would like to move between 0 and 8 in steps of 0.25. Ex. 0 - 0.25 - 0.5 - 0.75 etc.

Can anyone please help me? It would be very much appreciated.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ktd
  • 33
  • 1
  • 2

1 Answers1

2

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISlider_Class/#//apple_ref/occ/instm/UISlider/setValue:animated: supports float as well...

float roundedValue = roundf(value / 0.2f) * 0.2f; (use this to round....)

See here for a similar problem Increment UISlider by 0.2 in range 0 to 2.0

Community
  • 1
  • 1
John
  • 1,677
  • 4
  • 15
  • 26
  • 1
    Thank you for pointing me in the right direction. I ended up with the following code and it works just as I wanted. var roundedScaleSliderValue = round(scaleSliderValue.value * 4) / 4 – ktd Mar 29 '15 at 12:01