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);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…