【发布时间】:2015-08-10 17:03:50
【问题描述】:
我在视图中添加了一个 UISlider。我想知道是否可以移除旋钮或只是快速更改图像?我该怎么做?
【问题讨论】:
我在视图中添加了一个 UISlider。我想知道是否可以移除旋钮或只是快速更改图像?我该怎么做?
【问题讨论】:
滑块旋钮称为拇指图像,您可以使用setThumbImage:forState:方法更改它
mySlider.setThumbImage(nil, forState: UIControlState.Normal) // Remove the knob image by setting it to nil, or add your own image.
【讨论】:
适用于 Swift 5.0 或更高版本
for state: UIControl.State in [.normal, .selected, .application, .reserved] {
editorSlider.setThumbImage(UIImage.init(named: "slider_thumb"), for: state)
}
【讨论】: