views:

781

answers:

5

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.

A: 

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

Alex Reynolds
+4  A: 

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.

Ramin
A: 

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.

Ali Awais
A: 

Is there a way to get the "[yourslider setShowValue:TRUE];" value to show up in a UILabel? Thanks fo any help

JJ
A: 

can I get it to show only int values ?

ctn