I'm developing my first iOS app which contains a UISlider
. I know how to get the value when the UISlider
is dragged. But for my app I need to get the slider's value in a single touch; i.e. if I touch somewhere in the UISlider
, a UILabel
should display its correct value.
Is it possible to this way. Any tutorial or code will very helpful.
Swift version for accepted answer,
Please Write Following Code may be helpful for you :)
Here tapCount is
int
variable that declare in .h fileFor Swift User
Correction @ipatel: Math in previous answers is incomplete and causes jitter due to missing thumb width considerations.
Here is what it should look like if you choose to subclass
UISlider
:You can display the current value of
UISlider
with its action method like below.See these tutorials and examples of
UISlider
:This second tutorial with example which display the current (Latest) value of
UISlider
inUILable
see the image below for example.