I have the following custom class of a UIButton
, but when I add it to a button in Xcode I can not make the changes be reflected. Does anyone know what the problem is?
import UIKit
class BotonBordesRedondeados: UIButton {
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
/*override func draw(_ rect: CGRect) {
// Drawing code
setup()
}*/
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
}
func setup () {
self.layer.backgroundColor = ColorUtils.hexStringToUIColor(hex: "#6B00FF") as! CGColor
self.backgroundColor = ColorUtils.hexStringToUIColor(hex: "#6B00FF")
layer.borderColor = ColorUtils.hexStringToUIColor(hex: "#6B00FF").cgColor
layer.cornerRadius = 20
layer.borderWidth = 2.0
}
}