简体   繁体   中英

Slide UISlider programmatically

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM