所以这是我的代码:
@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变为白色。提前谢谢!