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

Issues when setting an initial Value other than 0 #15

Open
PlasmaSoftUK opened this issue Mar 13, 2022 · 1 comment
Open

Issues when setting an initial Value other than 0 #15

PlasmaSoftUK opened this issue Mar 13, 2022 · 1 comment

Comments

@PlasmaSoftUK
Copy link

PlasmaSoftUK commented Mar 13, 2022

This control works reasonably well, thank you for the time you put in to it. When using this control I want to set an initial value which I do with:

let slider = TvOSSlider(frame: CGRect(x: 100 y: 100, width: 1000, height: 50))
slider.minimumValue = 0
slider.maximumValue = 255
slider.value = 50
view.addSubview(slider)

The control takes this value, and when you read it back it returns 50, however the visual slider in the UI remains at 0. When you start to move it, the control resets its value to 0 and starts incrementing from there. Would be great if this could display the correct initial value.

@PlasmaSoftUK
Copy link
Author

PlasmaSoftUK commented Mar 14, 2022

This looks to be a race condition if I place a delay on setting the .value then the UI is updated....

        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
            self.slider.value = red
        }

Also interesting to note, is if you focus the control and then click Left or Right, the control updates to the correct value +/- the step. However if you use the Pan Gesture in this state the value starts at 0.

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

1 participant