简体   繁体   English

在Swift中更改UISlider thumb的大小

[英]Change the size of UISlider thumb in Swift

I am new to Swift. 我是Swift的新手。 I have a UISlider and I want to make the size of the thumb of UISlider to smaller. 我有一个UISlider ,我想使UISlider拇指大小变小。

I tried to set a smaller image using code : 我试图使用代码设置一个较小的图像:

self.setThumbImage(UIImage(named: "progress_thumb"), forState: .Normal)

But it stretches the image. 但这会拉伸图像。

Is it because of the image I have? 是因为我的形象吗? How can I implement thumbRectForBounds here? 如何在此处实现thumbRectForBounds

Please help me. 请帮我。

Thanks in advance. 提前致谢。

我现在解决了这个问题,这是由于图像大小所致,当我将图像切成更小的尺寸时,它以我想要的确切尺寸正确显示在UISlider中。

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

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