ios - 子类化 UISlider 以使用 IBDesignable/IBInspectable 自定义拇指图像?
问题描述
我正在使用此代码来自定义我的 UISlider 的 thumbImage。它在情节提要中正确构建,但是当我构建和运行时它不显示我的图像?可能是因为我也把它作为插座连接了吗?(必要,因为我需要在代码中设置滑块的值)
@IBDesignable
class DesignableSlider: UISlider {
@IBInspectable var thumbImage: UIImage? {
didSet{
setThumbImage(thumbImage, for: .normal)
}
}
}
解决方案
推荐阅读
- c++ - 在 VS C++ 调试器中调查变量
- firebase - 使用令牌信息创建地图时出错
- android - Dagger Hilt Android 给出错误:类 DefaultViewModelFactories 中的方法 getActivityFactory 不能应用于给定类型
- c - 在 XV6 中双重获得自旋锁
- arrays - 为什么此数组比较在 Google 表格中不起作用(使用 Apps 脚本)?
- laravel - Is my application architecture still SOA?
- json - 底部溢出 99397 像素的 RenderFlex
- javascript - 使用警报框进行确认
- android - AVC 拒绝为 Android Instant App 创建 DatagramSocket 错误
- amazon-web-services - 如何确定我的 AWS Glue 自定义 CSV 分类器是否正常工作?