I've added a UISlider to the view. I was wondering whether it is possible to remove the knob or just change the image in swift? How can i do this?
滑块旋钮称为拇指图像,您可以使用setThumbImage:forState:方法更改它
mySlider.setThumbImage(nil, forState: UIControlState.Normal) // Remove the knob image by setting it to nil, or add your own image.
For Swift 5.0 or Later Version
for state: UIControl.State in [.normal, .selected, .application, .reserved] {
editorSlider.setThumbImage(UIImage.init(named: "slider_thumb"), for: state)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.