//进度条
slide=UISlider.init(frame: CGRect.init(x: 80, y: 300, width: WIDTH-100, height: 50))
slide?.backgroundColor=UIColor.red//进度条总的背景
slide?.tintColor=UIColor.black//进度的颜色
slide?.thumbTintColor=UIColor.yellow//点击后滑块的颜色
slide?.minimumValue=1//最小值
slide?.maximumValue=10//最大值
slide?.setThumbImage(UIImage.init(named: "guanyu"), for: UIControlState.normal)//进度条上的滑块图片,如果是UIImage.init(),刚开始不显示,点击滑动时才显示,滑块的大小有提供的图片大小来控制
slide?.setValue(5, animated: true)//设置进度的值(滑块的位置)
// 按下的时候
slide?.addTarget(self, action: #selector(sliderTouchDown), for: UIControlEvents.touchDown)
// 弹起的时候
slide?.addTarget(self, action: #selector(sliderTouchUpOut), for: UIControlEvents.touchUpOutside)
slide?.addTarget(self, action: #selector(sliderTouchUpOut), for: UIControlEvents.touchUpInside)
slide?.addTarget(self, action: #selector(sliderTouchUpOut), for: UIControlEvents.touchCancel)
view.addSubview(slide!)
@objc func sliderTouchDown(){
}
@objc func sliderTouchUpOut(){
}