RangeSeekSlider
RangeSeekSlider copied to clipboard
Unable to set selectedMaxValue, selectedMinValue
As I am Assigning the CGFloat value in the viewDidAppear method it does not slide to my given value.
You need to call setNeedsLayout
after changing selectedMin / selectedMax
Yes it works.
Hope it could be fixed in the near future.
I had mine in a tableViewCell and this still didn't work. I had to wrap it in a DispatchQueue.main.async { } call and then call setNeedsLayout() inside the dispatchQueue. You can actually see the slider move into place sometimes. I should have just built my own control.
Search for following code in RangeSeekSlider.swift file
@IBInspectable open var selectedMaxValue: CGFloat = 100.0 {
didSet {
if selectedMaxValue > maxValue {
selectedMaxValue = maxValue
}
}
}
and add refresh method call in didSet like this:
@IBInspectable open var selectedMaxValue: CGFloat = 100.0 {
didSet {
if selectedMaxValue > maxValue {
selectedMaxValue = maxValue
}
refresh()
}
}
Do the same for selectedMinValue
@chitrakush this caused a crash due to recursion, as refresh() also sets selectMinValue or selectMaxValue. Did you not experience this?
@Beech316 please let me know if you managed to solve the problem?