views:

85

answers:

1

Hi all,

How can we set the thumb image of UISlider to stop once it reaches the max value .i.e once the thumb image reaches the max value(at the end) user should not be able to move the thumb image.

+3  A: 

Something like the following:

[slider setContinuous:YES];
[slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];

and then

- (void)sliderChanged:(UISlider*)sender {
    if ([slider value] >= [slider maximumValue]) {
      [slider setEnabled:NO];
    }
}
adam
thx a lot Adam!
Siddharth