Most of the UI is working

This commit is contained in:
Brent Marohnic 2013-02-14 19:21:16 -05:00
parent 2dfac4a1dd
commit 36d5d035b7
5 changed files with 867 additions and 63 deletions

View File

@ -11,11 +11,20 @@
@interface ViewController : UIViewController
{
IBOutlet UISegmentedControl *segmentControl;
UIViewController *viewController;
IBOutlet UIStepper *stepperControl;
IBOutlet UIButton *cricketButton;
IBOutlet UIButton *butterflyButton;
IBOutlet UIButton *antButton;
IBOutlet UIButton *executeButton;
IBOutlet UITextField *textBox;
}
-(IBAction)onChange:(id)sender;
-(IBAction)onClick:(id)sender;
-(IBAction)onStepChange:(id)sender;
-(IBAction)onClassButtonClick:(id)sender;
@end

View File

@ -15,6 +15,76 @@
@implementation ViewController
-(IBAction)onClassButtonClick:(id)sender
{
UIButton *classButton = (UIButton*)sender;
if (classButton.tag == 0)
{
textBox.text = @"Cricket";
stepperControl.enabled = TRUE;
classButton.enabled = FALSE;
antButton.enabled = TRUE;
butterflyButton.enabled = TRUE;
stepperControl.value = 0;
}
else if (classButton.tag == 1)
{
textBox.text = @"Butterfly";
stepperControl.enabled = TRUE;
classButton.enabled = FALSE;
antButton.enabled = TRUE;
cricketButton.enabled = TRUE;
stepperControl.value = 0;
}
else if (classButton.tag == 2)
{
textBox.text = @"Ant";
stepperControl.enabled = TRUE;
classButton.enabled = FALSE;
cricketButton.enabled = TRUE;
butterflyButton.enabled = TRUE;
stepperControl.value = 0;
}
}
-(IBAction)onStepChange:(id)sender
{
UIStepper *stepControl = (UIStepper*) sender;
if (stepControl != nil)
{
int currentValue = stepControl.value;
if (currentValue == 1)
{
if (cricketButton.enabled == FALSE)
{
textBox.text = @"Cricket";
}
else if (butterflyButton.enabled == FALSE)
{
textBox.text = @"Butterfly";
}
else textBox.text = @"Ant";
}
else
{
if (cricketButton.enabled == FALSE)
{
textBox.text = [NSString stringWithFormat:@"%d Crickets", currentValue];
}
else if (butterflyButton.enabled == FALSE)
{
textBox.text = [NSString stringWithFormat:@"%d Butterflies", currentValue];
}
else textBox.text = [NSString stringWithFormat:@"%d Ants", currentValue];
}
}
}
-(IBAction)onClick:(id)sender
{
ViewController2 *secondView = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];