Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCharles Harpke
33,986 PointsSliders.
I've tried knowledge basing this....as well as google...unsuccessfully. Where does the user enable sliders in the menu...on the side and bottom....on the interface itself. View menu? Navigate menu? Window menu? It would make navigation much less of a hassle.
1 Answer
Meek D
3,457 PointsWhen it comes to the UISlider , you need an IBAction and IBOutlet. So the purpose for the IBOutlet is to get the changed value when the user moves the slider (left to right or right to left ) and this value is saved into the SliderValue.value. Then the IBAction uses that value from the IBOutlet and assign it to whatever you want to do.
For example lets say i want to change my device volume when the slider was moved:
@IBOutlet weak var SliderValue : UISlider!
@IBAction func SliderChanged (sender : AnyObject){
// player is a variable that is instantiated from the AFAudio class
player.volume = SliderValue.value
}