Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

youngplayer

macrumors member
Original poster
May 16, 2008
36
0
Shanghai,China
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?
 

kpua

macrumors 6502
Jul 25, 2006
294
0
Are you positive that sender == oneButton? Check the pointers. You may find that things aren't connected correctly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.