Is there a way to setTitle on a UIButton that updates all UIControlStates at once?

According to the documentation you should only need to call:

In Objective-C:

[myButton setTitle:@"Play" forState:UIControlStateNormal];

In Swift:

myButton.setTitle("Play", for: .normal)

The UIButton docs explain why:

In general, if a property is not specified for a state, the default is to use the UIControlStateNormal value. If the value for UIControlStateNormal is not set, then the property defaults to a system value. Therefore, at a minimum, you should set the value for the normal state.

Namely, that if you only set the normal value the other states will refer to it when being set.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)