my codes:
IBOutlet NSButton* oneButton;
-(void) disableButton: (NSButton *) button{
[button setEnabled:NO];
}
-(IBAction) pressOneButton: (id) sender{
if([sender isEnabled] == YES){ // case 1
//do something;
}
if([oneButton isEnabled] == YES){ // case 2
//do something;
}
}
Obviously, I want to disable the button through the method disableButton. But unfortunately, case 1 doesn't work as my wish which case 2 does.
So, I'm puzzled. why the state of the 'sender' is different from the oneButton?
IBOutlet NSButton* oneButton;
-(void) disableButton: (NSButton *) button{
[button setEnabled:NO];
}
-(IBAction) pressOneButton: (id) sender{
if([sender isEnabled] == YES){ // case 1
//do something;
}
if([oneButton isEnabled] == YES){ // case 2
//do something;
}
}
Obviously, I want to disable the button through the method disableButton. But unfortunately, case 1 doesn't work as my wish which case 2 does.
So, I'm puzzled. why the state of the 'sender' is different from the oneButton?