在 Swift 中更改 UISlider 缩略图的大小

Change the size of UISlider thumb in Swift

我是 Swift 的新手。我有一个 UISlider,我想把 UISlider 的 thumb 的大小变小。

我尝试使用代码设置较小的图像:

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

但它会拉伸图像。

是因为我的形象吗?我怎样才能在这里实现 thumbRectForBounds

请帮帮我。

提前致谢。

我解决了now.It是因为图像size.When我把图像缩小到更小的尺寸,它正确地以我想要的确切尺寸显示在UISlider中。