Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide a UIButton when another button is tapped

How can I hide a UIButton on the tap of another button, or any other event?

like image 686
Vipin Avatar asked Apr 29 '11 09:04

Vipin


3 Answers

Create an outlet for the button to hide and connect it in your xib:

IBOutlet UIButton *myButton;

Now create an IBAction for the other button and connect it in the xib:

-(IBAction)hideButton
{
    myButton.hidden = YES;
}

So now when you click on the second button, it will hide myButton.

like image 143
dks1725 Avatar answered Nov 18 '22 08:11

dks1725


In your IBAction for the button tap:

 [*yourbutton* setHidden:YES];
like image 2
Gypsa Avatar answered Nov 18 '22 06:11

Gypsa


[self.btnReport setHidden:YES];
like image 1
Mitesh Khatri Avatar answered Nov 18 '22 08:11

Mitesh Khatri