【发布时间】:2017-03-31 11:52:29
【问题描述】:
我正在尝试使用图像进行自定义 uislider(没有可见旋钮,当用户无法编辑时将其隐藏并在可以时显示它)问题是侧面渲染完美,但右侧部分是可爱,似乎不使用边缘...... 知道如何编辑它吗?
实际代码:
let capLeft:CGFloat = 9
let capRight:CGFloat = 9
imageMin = imageMinimum?.resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: capLeft, bottom: 0, right: capRight), resizingMode: .stretch)
imageMax = imageMaximum
slider.setMaximumTrackImage(imageMax, for: UIControlState())
slider.setMinimumTrackImage(imageMin, for: UIControlState())
你有什么想法吗?
【问题讨论】:
-
请不要在意颜色,重要的是形状
-
嗯...你有缩略图吗?而且,如果滑块值设置为 100%,全长图像看起来是否正确?
-
100% 看起来不太好。而且我经常用大拇指盖住盖子,所以我不能用它来隐藏)
-
移除调整大小模式。试试这个 imageMinimum?.resizableImage(withCapInsets: UIEdgeInsets(top: 0, left: capLeft, bottom: 0, right: capRight))
-
jignesh-vadadoriya : 完全一样(resizingMode: .stretch 是默认值)
标签: ios swift uislider uiedgeinsets