子类化UISlider以使用IBDesignable / IBInspectable自定义拇指图像吗?

时间:2019-03-15 15:57:22

标签: ios swift uislider ibdesignable ibinspectable

我正在使用此代码from自定义UISlider的thumbImage。它可以在情节提要中正确构建,但是当我构建并运行时,它不会显示我的图像吗?可能是因为我也将其连接为插座吗? (这是必需的,因为我需要在代码中设置滑块的值)

@IBDesignable
class DesignableSlider: UISlider {



    @IBInspectable var thumbImage: UIImage? {
        didSet{
              setThumbImage(thumbImage, for: .normal)
        }
    }


}

0 个答案:

没有答案