Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reverse UISlider's min-max values?

Tags:

ios

uislider

Is there a good way to reverse UISlider values? The default is min on the left and max on the right. I'd like it to work the opposite way.

Rotating it 180 degrees seems a bit silly. Any ideas?

Thanks!

like image 906
dot Avatar asked Feb 15 '13 01:02

dot


2 Answers

Just subtract the value you get from the slider from the maximum value, that will reverse the values.

like image 136
rdelmar Avatar answered Nov 03 '22 21:11

rdelmar


I then needed the exact same thing as you...so rotated it another 90 degrees placing it in an upside down position. Slider is symetrical, so it looks exactly the same in both positions. But the min and max values are now the opposite.

Command is...

mySlider.transform = CGAffineTransformRotate(mySlider.transform, 180.0/180*M_PI);
like image 44
hossein hatami Avatar answered Nov 03 '22 21:11

hossein hatami