I am new to Objective-C and Cocoa-Touch development. I have an ON/OFF Switch on a view that is supposed to disable/enable hide/show another button on the same view, but for some reason it doesn't work sometimes, this is the behavior:
1st click: Switch to OFF, Other Button hidden => OK 2nd click: Switch to ON, Nothing happens => WRONG 3rd click: Switch to OFF, Other button SHOWN => WRONG 4th click: Switch to ON, Nothing happens => WRONG 5th click: Switch to OFF, Other Button hidden => OK
This is the code:
MainViewController.h :
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate> {
IBOutlet UIButton *resetButton;
}
@property (retain) UIButton *resetButton;
MainViewController.m :
@synthesize resetButton;
- (IBAction)switchTimer {
resetButton.enabled = !resetButton.enabled;
resetButton.hidden = !resetButton.hidden;
}
What am I doing wrong? I appreciate your help.