开发者

Hide a UIButton when another button is tapped

开发者 https://www.devze.com 2023-03-01 07:02 出处:网络
How can I hide a UIButton on the tap of ano开发者_运维问答ther button, or any other event?Create an outlet for the button to hide and connect it in your xib:

How can I hide a UIButton on the tap of ano开发者_运维问答ther button, or any other event?


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.


In your IBAction for the button tap:

 [*yourbutton* setHidden:YES];


[self.btnReport setHidden:YES];


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

That should do it.


Do this in your other button's tap action:

yourButton.hidden = YES;
0

精彩评论

暂无评论...
验证码 换一张
取 消