For example, I want to subclass UIButton
and set it's font to 20.0f
by default. I can write something like this:
@IBDesignable
class HCButton: UIButton {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.customInit()
}
func customInit () {
titleLabel?.font = UIFont.systemFontOfSize(20)
}
}
But this does not affect preview in Interface Builder, all custom buttons appear with 15.0f
font size by default. Any thoughts?
@IBInspectable var testFonts: UIFont
appear in Interface Builder? – Rubstone