Search code examples
iphoneobjective-cuibuttonsender

accessing UIButton by (id)sender


I have the following code

-(IBAction)ATapped:(id)sender{
//want some way to hide the button which is tapped
self.hidden = YES;
}

Which is linked to multiple buttons. I want to hide the button which triggered this IBAction. self.hidden is obviously not the button.

How do I hide the button which was tapped? The sender.

Thanks


Solution

  • Send setHidden message to sender:

    -(IBAction)ATapped:(id)sender{
       //want some way to hide the button which is tapped
       [sender setHidden:YES];
    }