当用户向前和向后移动时,是否可以动态更改滑块的minimumTrackTintColor?

时间:2017-07-19 19:31:30

标签: ios swift uislider

所以这是我的代码:

@IBOutlet weak var volumeSliderOutlet: UISlider!
@IBAction func volumeSliderAction(_ sender: UISlider) {

    player.volume = volumeSliderOutlet.value / 255

    let green = Float(255 / volumeSliderOutlet.value)

    volumeSliderOutlet.minimumTrackTintColor = UIColor(colorLiteralRed: 255.0, green: green, blue: 25.0, alpha: 1.0)

    print(green)

}

我尝试做的是在用户移动时更改volumeSliderOutlet的minimumTrackTintColor。一旦我触摸滑块圆圈,此代码就会将minimumTrackTintColor变为白色。提前谢谢!

0 个答案:

没有答案