rocket101 rocket101 - 1 year ago 74
Swift Question

Changing text of UIButton programatically swift

Simple question here. I have a UIButton, currencySelector, and I want to programatically change the text. Here's what I have:

currencySelector.text = "foobar"

XCode gives me the error "Expected Declaration". What am I doing wrong, and how can I make the button's text change?

Answer Source
button.setTitle("Button Title", forState: UIControlState.Normal)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download