I have a UISlider and I want it to stop at a certain value. This is not the maximum, but a number that is available programmatically.
Example: UISlider has max value of 100. The stop value is 60. Therefore, the user shouldn't be able to drag beyond 60.
The method I'm using right now is to add an action with a selector function, and there I would change the value back to the stopped position.
[mySlider addTarget:self action:@selector(modifySliderValue) forControlEvents:UIControlEventValueChanged];
...
- (void)modifySliderValue{
if(mySlider.value > 60) {
mySlider.value = 60;
}
}
This doesn't work well as the slider appears glitchy. It keeps trying to skip past the 60 mark and it doesn't look right.
What is the best way to achieve this?