Vipin
Vipin

Reputation: 4728

Hide a UIButton when another button is tapped

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

Upvotes: 12

Views: 29970

Answers (5)

Gypsa
Gypsa

Reputation: 11314

In your IBAction for the button tap:

 [*yourbutton* setHidden:YES];

Upvotes: 2

Krishnabhadra
Krishnabhadra

Reputation: 34296

Do this in your other button's tap action:

yourButton.hidden = YES;

Upvotes: 0

Thomas Stone
Thomas Stone

Reputation: 287

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

That should do it.

Upvotes: 0

dks1725
dks1725

Reputation: 1631

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.

Upvotes: 21

Mitesh Khatri
Mitesh Khatri

Reputation: 3955

[self.btnReport setHidden:YES];

Upvotes: 1

Related Questions