-1

I have a UISLider with certain values assigned to its each step. I'm getting those values from another VC and if the value is greater than the beginning of the slider, let's say the value is 50 out of 100 possible, I want to move the handle of the slider to represent that value, apparently to the middle and so on.

How do you do this easy task in iOS?

4

2 回答 2

9

Uh.. have you tried calling setValue:animated?

Or reading the docs?

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UISlider_Class/Reference/Reference.html

于 2013-04-23T16:04:18.820 回答
3

By default UISlider value should be between 0 and 1 (unless you've set minimumValue & maximumValue)

[yourSlider setValue:0.5 animated:YES];

See UISlider documentation for more information: http://developer.apple.com/library/ios/#documentation/uikit/reference/UISlider_Class/Reference/Reference.html

于 2013-04-23T16:03:52.677 回答