It’s not difficult to hide a UIButton typically, but I have it set to an IBAction instead of IBOutlet. This is necessary because when the button is pressed, text pops up, but then I want the button to disappear. What is the solution?
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.
You probably declared your IBAction like:
It should be:
Because then you can do in the method
All IBActions can support receiving their sender as a function. However, if a different UI element calls that function, it too will be hidden. Also, with the method above you’ll be unable to un-hide the button, and if you need to do that, you’d probably be better off having an IBOutlet – in 5.0+ you can use the
weakkeyword which does not retain a reference and is automatically nilled if the object is destroyed, and in 4.x you’ll just have to remember to set it to nil on viewDidUnload.