In UISlider Control if I set "MinimumValue = 0" & "MaximimValue=2000"
then I am not able to set the exact value. On release of slider thumb image it changes the value to + or - 5 to10
. My slider width = 225px
.
For example:- if I try to set the slider value to 100
then on release of slider thumb it shows me result like 105 or 95
.
Code
IBOutlet UISlider * slider;
//"Slider" Object attached using XIB(.NIB)
slider.minimumValue = 0;
slider.maximumValue = 100;
//Attached Below Method Using XIB(.NIB) with "value Changed" event.
-(IBAction)slider_Change:(id)sender;
{
//Assigning value to UITextField
textFiled.text = [NSString stringWithFormat:@"%d",(((int) (slider.value)) * 20)];
}
Because you have set your slider range to be so large each pixel on the screen is equivalent to 8.888.
2000 / 255 = 8.8888888889
To get graduations of 1 you'll need to move the slider 1/8 of a pixel (this is impossible).
Alternatives are: