Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically change button text [duplicate]

I am trying to programmatically change a button title's text, (the button is attached to an IBoutlet) but whenever I try to do the code _button.titlelabel = @"example text" it doesnt work! Please help me! (objective-c)


1 Answers

it should be like this :

For Objective C :

[_button setTitle:@"example text" forState:UIControlStateNormal];

For Swift :

_button.setTitle("example Text", forState: UIControlState.Normal)
like image 153
Hemant Solanki Avatar answered Nov 17 '25 16:11

Hemant Solanki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!