How do you change the text of the button and disable a button in iOS?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hey Namratha,
If you’re asking about changing the text and enabled/disabled state of a UIButton, it can be done pretty easily as follows;
If you have created the buttons in the Interface Builder and want to access them in code, you can take advantage of the fact that they are passed in as an argument to the
IBActioncalls:This can be bound to the button and you’ll get the button in the
senderargument when the action is triggered. If that’s not enough (because you need to access the buttons somewhere else than in the actions), declare an outlet for the button:Then it’s possible to bind the button in IB to the controller, the NIB loading code will set the property value when loading the interface.