UIButton title not displaying
In case you subclass UIButton and override its layoutSubviews()
, make sure you call super.layoutSubviews()
inside
For me the issue was that I wasn't using the setter methods.
I was doing notificationsButton.titleLabel?.text = "x"
instead of notificationsButton.setTitle("x", forState: UIControlState.Normal)
I actually figured out the issue.
In Swift the title of UIButton
is white.
I changed the background color of parent View, now it is showing.
self.view.backgroundColor = UIColor.black