0

I am working on UISlider functionality. I have only 4 range values (0, 1, 2, 3). So, I have given minimum value as 0 and maximum as 3. But my slider is not directly switching from 0-1, 1-2, 2-3. It is stopping in between 0-1 also. How to achieve this. I don't want to stop my slider pointer in-between my range values.

Please guide me the best approach for the above scenario.

Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
KiV
  • 2,225
  • 16
  • 18

1 Answers1

3

When you handle the value changed callback from the slider, modify the value. Something like:

slider.value = roundf(slider.value);
Wain
  • 118,658
  • 15
  • 128
  • 151
  • i used the below code and it worked great. // float roundedValue = roundf(sliderName.value / 1.0f) * 1.0f; [sliderName setValue:roundedValue]; – KiV Aug 07 '13 at 07:10