Hi, here is a class for a UIKIT button. Some of those settings work, usch as cornerRadius: it does affect the button display, but some doesn't.
For example, the size from
self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3)
has no effect at all on the text of the font inside the buttons.
Why is that? And how can I effectively alter the size of text from this subclass?
class VotingButtonStyle: UIButton {
override func draw(_ rect: CGRect) {
super.draw(rect)
self.clipsToBounds = true
self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3)
self.setTitleColor(.black, for: .normal)
self.titleLabel?.numberOfLines = 3
self.layer.cornerRadius = 8
}
}