简体   繁体   English

UISlider拇指图像在滑动时被隐藏

[英]UISlider thumb image is hidden on sliding

I have set thumb image for UISlider. 我已经为UISlider设置了缩略图。 This image is not reflected when i drag the slider. 当我拖动滑块时,此图像不会反映出来。 Once I finish the dragging then It is appearing. 一旦完成拖动,它就会出现。

I have set the image for all states 我已经为所有状态设置了图像

    [self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateNormal];
    [self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateSelected];

Use UIControlStateHighlighted to Show thumb image while dragging. 使用UIControlStateHighlighted在拖动时显示拇指图像。

like below. 像下面

[self.myslider setThumbImage:[UIImage imageNamed:kPlayerScreenHandleImage] forState:UIControlStateHighlighted];

Hope it helps.. 希望能帮助到你..

You should set both images, that is while normal and also during highlight 您应该同时设置两个图像,即正常图像和高光图像

 rangeSlider.setThumbImage(UIImage(named : "yourImage"), for: .normal)
 rangeSlider.setThumbImage(UIImage(named : "yourImage"), for: .highlighted)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM