Adjust slider position
According to your code, you could:
self.slider.value = (90);
Note: There is no real need for self
when you reference an IBOutlet
from the same class.
If you want a truly dynamic way to set the UISlider
sign halfway, you simply divide your maximum value by 2, effectively halve it:
self.slider.value = (self.slider.maximumValue / 2);
Increment in multipliers 10
For this, I would suggest a little different from what you have. Instead of having a minimum of 10 and a maximum of 180, at least a minimum of 1 and a maximum of 18?
self.slider.minimumValue = 1; self.slider.maximumValue = 18;
Each time you extract the value of the slider, simply multiply it by 10. Thus, the slider moves to 18 different locations (as you like), and you always get a multiple of 10.
int trueSliderValue = self.slider.value * 10;
source share