Reputation: 108
I have 2 NSButtons, Both IBActions. When I click one of the buttons, I want the other button to be hidden. I can make them Hide themselves, but I can't figure out how to hide the other one. My actual implementation for this is to have a 'start' button, that is hidden until the user is finished doing some tasks, then shows up again with the other objects being hidden.
Thanks for your help!
@interface Label : NSObject
{
IBOutlet NSTextField *myTextField;
}
-(IBAction)btnTest1:(id)sender;
-(IBAction)btnTest2:(id)sender;
-(IBAction)btnTest1:(id)sender
{
myTextField.stringValue = @"You selected the 1st Button";
NSButton *tempButton = sender;
[tempButton setHidden:YES];
}
-(IBAction)btnTest2:(id)sender
{
myTextField.stringValue = @"You selected the 2nd Button";
NSButton *tempButton = sender;
[tempButton setHidden:YES];
}
Upvotes: 1
Views: 2729
Reputation: 4235
@interface Label : NSObject
{
IBOutlet NSTextField *myTextField;
IBOutlet NSButton *btn1;
IBOutlet NSButton *btn2;
}
in method : [btn1 setHidden: YES]
for btn2 the same.
Upvotes: 1