RangeSeekSlider icon indicating copy to clipboard operation
RangeSeekSlider copied to clipboard

Unable to set selectedMaxValue, selectedMinValue

Open yashriosdev opened this issue 4 years ago • 7 comments

As I am Assigning the CGFloat value in the viewDidAppear method it does not slide to my given value.

yashriosdev avatar Dec 20 '19 05:12 yashriosdev

You need to call setNeedsLayout after changing selectedMin / selectedMax

lordzsolt avatar Jan 28 '20 19:01 lordzsolt

Yes it works.

Parth-Patoliya avatar Jul 02 '20 09:07 Parth-Patoliya

Hope it could be fixed in the near future.

tounaobun avatar Oct 08 '20 03:10 tounaobun

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.

philosopherdog avatar Nov 26 '20 00:11 philosopherdog

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 avatar Jun 03 '21 10:06 chitrakush

@chitrakush this caused a crash due to recursion, as refresh() also sets selectMinValue or selectMaxValue. Did you not experience this?

Beech316 avatar Aug 10 '21 17:08 Beech316

@Beech316 please let me know if you managed to solve the problem?

rishatyakushev avatar Oct 05 '22 10:10 rishatyakushev