rocket101 rocket101 - 5 months ago 13
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
button.setTitle("Button Title", forState: UIControlState.Normal)