Setting interval value for UISlider

Manmay picture Manmay · Apr 11, 2011 · Viewed 12.8k times · Source

I need to set the interval value for an UISlider.

Please help..

Answer

Mike A picture Mike A · Apr 11, 2011

yourSlider.value = x;

You should really read the documentation, lots of great resources in the iOS Developer Center.

Edit: With regards to your more specific question in the comments:

yourSlider.minimumValue = -10;
yourSlider.maximumValue = 10;
[yourSlider addTarget:self action:@selector(roundValue) forControlEvents:UIControlEventValueChanged];

- (void)roundValue{
    yourSlider.value = round(yourSlider.value);
}