Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show value of UISlider as Integer

The value of the UISlider currently shows as a float. How do I show it as an integer?

sliderCtl = [[UISlider alloc] initWithFrame:frame];
    sliderCtl.minimumValue = 1;
    sliderCtl.maximumValue = 15;
    sliderCtl.continuous = NO;
    sliderCtl.value = 1;
    [sliderCtl setShowValue:YES];
like image 939
RAGOpoR Avatar asked Dec 02 '09 04:12

RAGOpoR


1 Answers

You could truncate or round the value from the slider and then update it to give the user feedback about the change (it would appear to snap to the integer value when the user releases).

like image 182
gerry3 Avatar answered Oct 07 '22 00:10

gerry3