【发布时间】:2018-07-10 11:46:47
【问题描述】:
我有一个 UIButton 的 IBDesignable 子类,但我的更改没有出现在我使用它的情节提要上。我尝试刷新我的故事板上的所有视图,或者将按钮与类重新链接,但无济于事。
班级:
@IBDesignable class MyButton: UIButton {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
func commonInit() {
layer.cornerRadius = 3
layer.masksToBounds = true
backgroundColor = Colors.E9511C
setTitleColor(.white, for: .normal)
titleLabel?.font = Fonts.openSansBold(14)
}
}
【问题讨论】:
标签: ios uistoryboard ibdesignable