Justin Copeland
Justin Copeland

Reputation: 1951

How do I let the user see the value of a UISlider?

I added a UISlider in interface builder in my iOS application. Can I make it so that the user can see the value of a UISlider while he/she is altering it?

Is there an interface builder setting I can change to easily implement this, or must I implement an IBAction that alters a UILabel on the screen based on the slider's value?

Upvotes: 1

Views: 65

Answers (2)

Jorge Aguirre
Jorge Aguirre

Reputation: 2857

Yes there is. You can set an outlet of type

    IBOutlet UISlider *slider

in your view controller, then bind it to the slider. Then the value of the slider is always accessible through the slider.value property, even in other methods.

Upvotes: 1

tipycalFlow
tipycalFlow

Reputation: 7644

Connect the UISlider's valueChanged selector to your custom IBAction and set some UILabel's value in that method

Upvotes: 2

Related Questions