Take the 2-minute tour ×

I have to show ths slider values with the movement of the slider. Is there any existing function I can use. Coz I was trying to get a method other than placing labels to show the updated value along with the slider.

Is there a way to show uislider value with slider? or if any other way please reply.

share|improve this question
add comment

3 Answers

There's no built-in way.

The simplest way to do it is to do have a text label and stuff the slider value into it as the user moves the thumb.

Here's how: create a UISlider and a UILabel in Interface Builder and declare an IBAction in your UIViewController code. Connect the slider's 'Value Changed' outlet to it. Assign the UILabel to an IBOutlet property as well and connect it in IB. Mark the slider as 'continuous' in IB so it keeps sending events as you change it.

In the IBAction method take the sender's .value property, format it as a string, and assign it to the label's .text property. You can position and format the UILabel anywhere you want.

share|improve this answer
add comment

Just put a UILabel near the slider and update its value when the slider position is changed.

share|improve this answer
add comment

You can use the following property [yourslider setShowValue:TRUE];

It will display the value of the slider on right side of the slider. However you might see a warning when building the code but it works, need to see if it is deprecated or not.

share|improve this answer
(comment incorrectly posted as a mod-flag): There's no setShowValue method on UISlider - dhttp://developer.apple.com/library/ios/#documentation/UIKit/Reference/UISlider_‌​Class/Reference/Reference.html. If there was, it would take YES and NO instead of TRUE and FALSE as arguments. –  Marc Gravell Mar 17 '11 at 8:17
add comment

Your Answer


