while i create my UIButton on Interface builder, i put a text like Button 1.
when i launch the application, i change programmatically the text to something else like this:
btn1.titleLabel.text=@"Hello";
Everything is ok until i press the button, it got its default text which is Button 1.
My purpose is that, if the text has been changed programmatically, it can’t get its default text value when i press the button, i mean the text Hello should remain. How can i do that please? Thanx in advance 🙂
Don’t change the textLabel directly, use setTitle:forState: instead…
See UIButton reference