jwd-ali/Switch-Animations

setOn error

Closed this issue · 0 comments

When I tried to set the control to open when the page was initialized, the background color of the control was not set successfully

        didSet {
            allSwitch.offThumbTintColor = .white
            allSwitch.onThumbTintColor = .white
            allSwitch.slimTrack = 2
            allSwitch.thumbRadiusPadding = 5
            allSwitch.onTintColor = 0x8BDD68.color
            allSwitch.offTintColor = 0xDDDDDD.color
            allSwitch.shape = .rounded
            allSwitch.thumbCornerRadius = 10
            allSwitch.trackTopBottomPadding = 5
            allSwitch.shadowColor = .gray.alpha(0.3)
            }
        }
        
and then setOn in viewDidLoad :

allSwitch.setOn( true, animated: true)