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

Track On Fill colour not working correctly. #6

Closed
NSRover opened this issue Sep 15, 2018 · 2 comments
Closed

Track On Fill colour not working correctly. #6

NSRover opened this issue Sep 15, 2018 · 2 comments

Comments

@NSRover
Copy link

NSRover commented Sep 15, 2018

I have created a PWSwitch like so:

let customSwitch = PWSwitch(frame: CGRect(x: 0, y: 0, width: 36, height: 20))
customSwitch.borderWidth = 0
customSwitch.trackOnFillColor = .red
customSwitch.trackOffFillColor = .green

The red colour is only visible briefly during the transition and is replaced by a mustard yellow when the switch is On.

@NSRover
Copy link
Author

NSRover commented Sep 15, 2018

I could achieve the desired result by also setting

customSwitch.trackOnBorderColor = .red

However, since the border width is set to 0 this should not have been necessary.

@Shaninnik
Copy link
Owner

Track/border color logic is a bit tricky because of on/off animation - border completely fills in entire track and acts like background color, so sometimes you need to experiment with values to achieve desired effect.

Also there is no borderWidth property for PWSwitch

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

2 participants