Reputation: 6660
I have a UISlider
with minimumValue 0
and maximumValue
. I want to make an interval
of 0.5
and display it in a label
(it's working).
How can I set the interval of my slider
? I tried solution to round the value... but I failed.
Thank you
Upvotes: 1
Views: 4060
Reputation: 5555
when i do something like that i take an approach like the following:
#define kSTEPFRACTION .5
SliderMin = 0
sliderMax = 20
and get the value withs something like that
value = slider.value*kSTEPFRACTION;
this will give you values between 0 and 10 in steps of 0.5
sebastian
Upvotes: 0
Reputation: 104698
float RoundValue(UISlider * slider) {
return roundf(slider.value * 2.0) * 0.5;
}
Upvotes: 16