2

Possible Duplicate:
Increment UISlider by 1 in range 1 to 100
Increment UISlider by 0.2 in range 0 to 2.0

In my iPad app i have used uislider as a part.

in that i have 3 points 1 2 3.

as per ui design my slider is too long (it should be in that much width) in width,

So my requirement is jump the Slider THUMB

When user want to change the value from 1 to 2 , 2 to 3the Slider THUMB position directly jumps to the point2, and point 3 respectualy with out lagging. and viceversa.

How can we do it

Thanx in advance

Community
  • 1
  • 1
user1645721
  • 653
  • 2
  • 8
  • 18

2 Answers2

2

try this code..

float roundedValue = roundf(yourSlider.value / 1.0f) * 1.0f;    
[yourSlider setValue:roundedValue];

i hope this help you...

Paras Joshi
  • 20,427
  • 11
  • 57
  • 70
1

You can do like this.

[mySlider setMaximumValue:3.0];
[mySlider setContinuous:YES];
[slider addTarget:self action:@selector(sliderChangedAction:) forControlEvents:UIControlEventValueChanged];


- (IBAction)sliderChangedAction:(id)sender {
    UISlider * mySlider = (UISlider*)sender;    
    [mySlider setValue:ceilf(mySlider.value)];

}
Ramaraj T
  • 5,184
  • 4
  • 35
  • 68