Reputation: 25
I have changed button text on swift like this:
btn_text.setTitle("Hello", for: .normal)
inside viewDidLoad
which works well except on the very first load of the app it just shows "button".
So when I install the app for the first time on a device it just shows default button name as opposed to what I assigned to it. But if I kill the app and run it again it works just fine afterward. Is there something I am supposed to be doing for the first load? Might be on app delagate? Or am I supposed to be putting it somewhere else?
Thanks
Upvotes: 0
Views: 76
Reputation: 70703
Make sure your override of viewDidLoad() runs
super.viewDidLoad()
before you modify the button title.
Upvotes: 1