This is working great:
let label = UILabel()
label.text = VARIABLE_LENGTH_STRING
stackView?.addArrangedSubview(label)
but this does not work
let button = UIButton()
button.setTitle(VARIABLE_LENGTH_STRING, for: .normal)
stackView?.addArrangedSubview(button)
Nothing displays! any idea why? I'd expect labels to behave pretty simularly to buttons...
Thanks for your help!
The problem is that by default - a new UIButton() has white text and a white background --- grrrr!
i fixed this by doing:
button.setTitleColor(.blue, for: .normal)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With