Eureka: SliderRow/Cell not able to user formatter property

Created on 9 Sep 2016  路  2Comments  路  Source: xmartlabs/Eureka

What is the purpose of this property

``````
public class SliderCell: Cell, CellType {

`````\
public var formatter: NSNumberFormatter?
`````\

}
``````

formatter is declared but i guess not using anywhere. I just want to display Integer value in valueLabel.

  • So i have tried following things to achieve
 SliderRow.defaultCellSetup = { Cell,row in

            let numberFormatter = NSNumberFormatter()
            numberFormatter.numberStyle = .DecimalStyle
            numberFormatter.minimumFractionDigits = 0
            Cell.formatter = numberFormatter

     }

defaultCellSetup and defaultCellUpdate not working anymore.

SliderRow question

Most helpful comment

You do not need to use the formatter for this.
You should first correctly set the steps for your interval. And then make sure the value is displayed as an Int and not a Float.

In the examples there is a slider with the default values: minimumValue = 0.0, maximumValue = 10.0, steps = 20

So, adding the following lines solves your problem:

       $0.steps = 10
       $0.displayValueFor = {
            return String(Int($0!))
       }

All 2 comments

You do not need to use the formatter for this.
You should first correctly set the steps for your interval. And then make sure the value is displayed as an Int and not a Float.

In the examples there is a slider with the default values: minimumValue = 0.0, maximumValue = 10.0, steps = 20

So, adding the following lines solves your problem:

       $0.steps = 10
       $0.displayValueFor = {
            return String(Int($0!))
       }

Great

Was this page helpful?
0 / 5 - 0 ratings