Setting the slider to the maximum value

I am creating a light application in which I display an image of light. In the light, I change the brightness of the light. If I set the minimum and maximum value of the slider as

slider.minimumValue = -100; slider.maximumValue = 100; 

then the slider shows the marker at the 0th position, which is displayed as in the center. But now the initial and maximum value of the slider has been changed as

 slider.minimumValue = 0; slider.maximumValue = 100; 

I want my slider marker to be initially at the 100th position of the slider, that is, in the upper position of the slider.

Please help me solve this problem.

+4
source share
5 answers

try it

 [slider setValue:100.0f animated:NO]; 
+5
source

You can set the value of the slider.

 [slider setValue: 100.0f];

+3
source

Try setting the slider value as max

 [slider setValue:100.0f]; 
+2
source
 slider.value = 100.0f; 

will do the trick.

+1
source

Try setting the slider value:

initialization slider:

slider.value = 5.0;

minimum value:

slider.minimumValue = 0.0;

maximum value:

slider.maximumValue = 100.0;

0
source

Source: https://habr.com/ru/post/1392038/


All Articles