I feel like this is probably a stupid question... but anyway I have this kind of weird UIButton
title behavior.
The button is set up and connected to bo
The swift version of this is
startButton.setTitle("Start", forState: UIControlState.Normal)
You need to use setTitle:forState:
method instead of setting the titleLabel.text
property:
[startButton setTitle:@"Start" forState:UIControlStateNormal];
// Normal and highlighted titles do not need to be the same
[startButton setTitle:@"Start!" forState:UIControlStateHighlighted];
What happens now is that you set the title in the label that represents the view of the current state, but once the state changes from pushed to normal, the button resets the label back to the title for the new state (which is the text that you set in the IB).