如何自定义UISlider高度 [英] How to customise UISlider height
本文介绍了如何自定义UISlider高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目必须自定义 UISlider
元素。
我想知道是否有人知道如何更改,或者是否可以更改 UISlide
条线的高度。
I have project in which have to customise UISlider
element.
I wondering if someone knows how to change, or is it possible to change height of UISlide
bar line.
我尝试了类似的功能但不起作用:
let customBounds = CGRect(origin: bounds.origin,
size: CGSize(width: bounds.size.width, height: 15.0))
feedbackSlider.trackRectForBounds(customBounds)
谢谢
推荐答案
我希望你想要编辑它故事板,只有行大小,在自定义UISlider中使用它
i hope that you want edit it in storyboard, and only the line size, use it in your custom UISlider
class CustomSlide: UISlider {
@IBInspectable var trackHeight: CGFloat = 2
override func trackRectForBounds(bounds: CGRect) -> CGRect {
//set your bounds here
return CGRect(origin: bounds.origin, size: CGSizeMake(bounds.width, trackHeight))
}
}
这篇关于如何自定义UISlider高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文