gpt4 book ai didi

ios - 如何自定义UISlider高度

转载 作者:IT王子 更新时间:2023-10-29 05:38:59 24 4
gpt4 key购买 nike

我有一个项目,其中必须自定义 UISlider 元素。我想知道是否有人知道如何更改,或者是否可以更改 UISlide 栏线的高度。

我试过这样的东西但没有用:

let customBounds = CGRect(origin: bounds.origin, 
size: CGSize(width: bounds.size.width, height: 15.0))
feedbackSlider.trackRectForBounds(customBounds)

谢谢

最佳答案

我希望你想在 Storyboard中编辑它,并且只有行大小,在你的自定义 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))



}
}

关于ios - 如何自定义UISlider高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31590188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com