Is it possible to make @IBDesignable override Interface Builder values?
I have created new IBInspectable
as testFonts
:
import UIKit
@IBDesignable
class CustomButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
self.customInit()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.customInit()
}
func customInit () {
titleLabel?.font = UIFont.systemFontOfSize(20)
}
convenience init() {
self.init(frame:CGRectZero)
self.customInit()
}
override func awakeFromNib() {
super.awakeFromNib()
self.customInit()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
self.customInit()
}
}
Hope it helps you :)
This is working for me.