UISlider 轨道高度 [英] UISlider track height

查看:31
本文介绍了UISlider 轨道高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了 UISlider,我需要调整轨道高度.我发现了这个,但它不起作用.

I have implemented UISlider and I need to adjust track height. I found this but its not working.

self.slider.trackRect(forBounds: CGRect(x: 0, y: 0, width: 100, height: 100))

推荐答案

找到了,但是没用

found this but its not working

因为你用错了.你不调用它.您子类化,然后覆盖它.

Because you're using it wrong. You don't call it. You subclass, and override it.

然而,正确的方法是为轨道提供新的图像,使用 setMinimumTrackImagesetMaximumTrackImage.

However, the right approach is to supply new images for the track, with setMinimumTrackImage and setMaximumTrackImage.

这篇关于UISlider 轨道高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆