Search code examples
iosobjective-cuislider

how to set uislider value with 0.5 interval


Having a UISLider with min value 5 and max value 10 how can I show the value range with 0.5 interval in uilabel

_ie.text = [NSString stringWithFormat:@"%0.1f",(_Iel.value)];

Solution

  • You can round like this:

    _ie.text = [NSString stringWithFormat:@"%0.1f",(roundf(_Iel.value * 2.0) * 0.5)];