0

How to set the UISlider slide range? If the UISlider'range is [0,100],How to set the UISlider slide between range[10,90]?

Many thanks~

matrix1024
  • 27
  • 1
  • 8
  • Like this? http://stackoverflow.com/a/10701693/1648976 – David Raijmakers Oct 22 '12 at 08:57
  • Why would you want a range from `[10,90]` do you want to the slider to display the `10` at the beginning and and? otherwise you could do with `[0,80]` – rckoenes Oct 22 '12 at 09:06
  • Hello,I wana to user UISlider to customize a CustomizeSwitch,like UISwitch,and the thumb image should start at 10 and end at 90,many thanks for ur help~~ – matrix1024 Oct 22 '12 at 10:03

2 Answers2

0

Try this :

_slider.minimumValue = minValue;
_slider.maximumValue = maxValue;

_slider.value = yourValue;
rdurand
  • 7,342
  • 3
  • 39
  • 72
  • As you share,I programming like that,but sound like that the thumb can slide <10 and >90. – matrix1024 Oct 22 '12 at 09:48
  • Well, that's how you do it. Add an *IBAction* from interface builder to your .h with "sliderValueChanged", and put *NSLog("%f", _slider.value)* in it. It will log the value of the slider when you slide the handle. – rdurand Oct 22 '12 at 09:53
0

Say your slider is named "slider"

You would just do :

slider.minimumValue = 10;
slider.maximumValue = 90;