let slider = UISlider(frame: CGRect(x: 50, y: 100, width: 300, height: 30))
slider.center = self.view.center
//最小值
slider.minimumValue = 0
//最大值
slider.maximumValue = 10
//当前值
//slider.value = 5.0
slider.setValue(8.0, animated: true)
//滑动方法
//滑动停止后才触发方法
slider.isContinuous = false
slider.addTarget(self, action: #selector(slederClick(_:)), for: .valueChanged)
//滑块两侧添加图标
slider.minimumValueImage = UIImage(named: "jian")
slider.maximumValueImage = UIImage(named: "jia")
self.view.addSubview(slider)
func slederClick(_ slider:(UISlider))
{
print("\(slider.value)")
}