iOS UIButton Set title

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Swift

button.setTitle(titleString, forState: controlState)

Objective C

[button setTitle:(NSString *) forState:(UIControlState)];

To set the default title to "Hello, World!"

Swift

button.setTitle("Hello, World!", forState: .normal)

Objective C

[button setTitle:@"Hello, World!" forControlState:UIControlStateNormal];


Got any iOS Question?