Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set selectedMaxValue, selectedMinValue #87

Open
yashriosdev opened this issue Dec 20, 2019 · 7 comments
Open

Unable to set selectedMaxValue, selectedMinValue #87

yashriosdev opened this issue Dec 20, 2019 · 7 comments

Comments

@yashriosdev
Copy link

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

@lordzsolt
Copy link

You need to call setNeedsLayout after changing selectedMin / selectedMax

@Parth-Patoliya
Copy link

Yes it works.

@tounaobun
Copy link

Hope it could be fixed in the near future.

@philosopherdog
Copy link

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.

@chitrakush
Copy link

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

@Beech316
Copy link

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

@rishatyakushev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants