diff --git a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 55989ea..fe2b454 100644 --- a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,22 +2,4 @@ - - - - - - diff --git a/FMC Planner 2/Base.lproj/Main.storyboard b/FMC Planner 2/Base.lproj/Main.storyboard index 35fb49f..966e144 100644 --- a/FMC Planner 2/Base.lproj/Main.storyboard +++ b/FMC Planner 2/Base.lproj/Main.storyboard @@ -19,673 +19,709 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FMC Planner 2/ViewController.h b/FMC Planner 2/ViewController.h index e82233c..2cffaf2 100644 --- a/FMC Planner 2/ViewController.h +++ b/FMC Planner 2/ViewController.h @@ -10,6 +10,23 @@ @interface ViewController : UIViewController +@property(nonatomic) BOOL alphaOn; + +@property(strong, nonatomic) NSArray *alphabet; +@property(strong, nonatomic) NSArray *numeric; + +@property(strong, nonatomic) IBOutletCollection(UIButton) NSArray *Keys; + +@property(strong, nonatomic) IBOutlet UIView *backdropKeys; + +@property(strong, nonatomic) IBOutlet UIView *backdropScreen; + +@property(strong, nonatomic) IBOutletCollection(UILabel) NSArray *ScreenLabels; + +@property(strong, nonatomic) IBOutlet UILabel *Scratchpad; + +@property(strong, nonatomic) IBOutlet UILabel *Header; + +- (IBAction)KeyTaps:(UIButton *)sender; @end - diff --git a/FMC Planner 2/ViewController.m b/FMC Planner 2/ViewController.m index 93550c8..04febf1 100644 --- a/FMC Planner 2/ViewController.m +++ b/FMC Planner 2/ViewController.m @@ -8,19 +8,45 @@ #import "ViewController.h" -int SPACING = 10; -int NUM_BUTTONS_PER_ROW = 5; -int NUM_ROWS_OF_BUTTON = 6; - -@interface ViewController () - -@end - @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. + _alphaOn = true; + _alphabet = [[NSArray alloc] + initWithObjects:@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", + @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", + @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", @"SP", + @"CLR", @"DEL", @"NUM", nil]; + _numeric = [[NSArray alloc] + initWithObjects:@"1", @"2", @"3", @"", @"", @"", @"4", @"5", @"6", + @"", @"", @"", @"7", @"8", @"9", @"", @"", @"", + @".", @"0", @"/", @"", @"", @"", @"", @"", @"SP", + @"CLR", @"DEL", @"LET", nil]; + + // Round corners + _backdropKeys.layer.cornerRadius = 5; + _backdropKeys.layer.masksToBounds = YES; + _backdropScreen.layer.cornerRadius = 5; + _backdropScreen.layer.masksToBounds = YES; + for (UIButton *but in _Keys) { + but.layer.cornerRadius = 5; + but.layer.masksToBounds = YES; + } + // Set Font Size + if (self.view.frame.size.height == 480) { + for (UILabel *label in _ScreenLabels) { + label.font = [UIFont systemFontOfSize:14]; + } + _Header.font = [UIFont systemFontOfSize:14]; + _Scratchpad.font = [UIFont systemFontOfSize:14]; + } + + // Init Start Page + [self clearScreen]; + _Header.text = @"START"; + _Scratchpad.text = @""; } - (void)didReceiveMemoryWarning { @@ -28,4 +54,49 @@ int NUM_ROWS_OF_BUTTON = 6; // Dispose of any resources that can be recreated. } +- (IBAction)KeyTaps:(UIButton *)sender { + if ([sender.restorationIdentifier isEqualToString:@"Switch"]) { + _alphaOn = !_alphaOn; + [self switchKeyboard]; + } else if ([sender.restorationIdentifier isEqualToString:@"Space"]) { + _Scratchpad.text = [_Scratchpad.text stringByAppendingString:@" "]; + } else if ([sender.restorationIdentifier isEqualToString:@"Clear"]) { + if ([_Scratchpad.text isEqualToString:@"DELETE"]) { + _Scratchpad.text = @""; + } else if (_Scratchpad.text.length > 0) { + _Scratchpad.text = + [_Scratchpad.text substringToIndex:[_Scratchpad.text length] - 1]; + } + } else if ([sender.restorationIdentifier isEqualToString:@"Delete"]) { + _Scratchpad.text = @"DELETE"; + } else { + _Scratchpad.text = + [_Scratchpad.text stringByAppendingString:sender.titleLabel.text]; + } +} + +- (void)clearScreen { + for (UILabel *label in _ScreenLabels) { + label.text = @""; + } + _Scratchpad.text = @""; + _Header.text = @""; +} + +- (void)switchKeyboard { + if (_alphaOn) { + for (int i = 0; i < _Keys.count; i++) { + [((UIButton *)_Keys[i]) setTitle:_alphabet[i] + forState:UIControlStateNormal]; + [((UIButton *)_Keys[i]).titleLabel sizeToFit]; + } + } else { + for (int i = 0; i < _Keys.count; i++) { + [((UIButton *)_Keys[i]) setTitle:_numeric[i] + forState:UIControlStateNormal]; + [((UIButton *)_Keys[i]).titleLabel sizeToFit]; + } + } +} + @end