diff --git a/IfElse/.DS_Store b/IfElse/.DS_Store new file mode 100644 index 0000000..e7acad0 Binary files /dev/null and b/IfElse/.DS_Store differ diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout index c528788..b3ab1bb 100644 --- a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout +++ b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcshareddata/IfElse.xccheckout @@ -7,34 +7,34 @@ IDESourceControlProjectIdentifier 1FB1EB48-B010-423E-B8FC-A6EF94AD96F8 IDESourceControlProjectName - project + IfElse IDESourceControlProjectOriginsDictionary - 871AD5BEB35E842816B7B3CF4033C4298E764D23 - https://github.com/accesscode-2-2/unit-0.git + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E + https://github.com/vhart/IfElse.git IDESourceControlProjectPath - lessons/week-0/IfElse/IfElse.xcodeproj/project.xcworkspace + IfElse/IfElse.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary - 871AD5BEB35E842816B7B3CF4033C4298E764D23 - ../../../../.. + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E + ../../.. IDESourceControlProjectURL - https://github.com/accesscode-2-2/unit-0.git + https://github.com/vhart/IfElse.git IDESourceControlProjectVersion 111 IDESourceControlProjectWCCIdentifier - 871AD5BEB35E842816B7B3CF4033C4298E764D23 + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 871AD5BEB35E842816B7B3CF4033C4298E764D23 + BAD0033D05756E529C5FF0EABC2DBC15B8B8219E IDESourceControlWCCName - unit-0 + IfElse diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/varindra.xcuserdatad/UserInterfaceState.xcuserstate b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/varindra.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..fbc0662 Binary files /dev/null and b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/varindra.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/IfElse.xcscheme b/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/IfElse.xcscheme new file mode 100644 index 0000000..6485954 --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/IfElse.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/xcschememanagement.plist b/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..44aa48b --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/varindra.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + IfElse.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DFE63E81B22A54400D3D7AA + + primary + + + 8DFE64011B22A54400D3D7AA + + primary + + + + + diff --git a/IfElse/IfElse/Base.lproj/Main.storyboard b/IfElse/IfElse/Base.lproj/Main.storyboard index 34c014c..c72bee8 100644 --- a/IfElse/IfElse/Base.lproj/Main.storyboard +++ b/IfElse/IfElse/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + + @@ -35,18 +36,48 @@ + + + - + - + - + + + + + + + + + + + + + + + + + + + + @@ -70,51 +101,69 @@ - + + + + + - - - - - - + + + + + + + - - + + + + + - - - - - - + + + + + + + - + + + + + + + + + + diff --git a/IfElse/IfElse/ViewController.m b/IfElse/IfElse/ViewController.m index b3ee131..7d3277e 100644 --- a/IfElse/IfElse/ViewController.m +++ b/IfElse/IfElse/ViewController.m @@ -9,19 +9,90 @@ #import "ViewController.h" @interface ViewController () +@property (weak, nonatomic) IBOutlet UITextField *textField1; +@property (weak, nonatomic) IBOutlet UITextField *textField2; +@property (weak, nonatomic) IBOutlet UITextField *textField3; +@property (weak, nonatomic) IBOutlet UISwitch *switch1; +@property (weak, nonatomic) IBOutlet UISwitch *switch2; +@property (weak, nonatomic) IBOutlet UISwitch *switch3; +@property (weak, nonatomic) IBOutlet UILabel *labelOutput; @end @implementation ViewController -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (IBAction)button:(id)sender { + NSLog(@"tapped"); + NSString *textField1Value = self.textField1.text ; + NSString *textField2Value = self.textField2.text ; + NSString *textField3Value = self.textField3.text ; + NSInteger age = [textField3Value integerValue]; + NSLog(@"%@",textField1Value); + NSString *read = @""; + if([textField1Value length] > 5){ + read=[[read stringByAppendingString:@"Yeah... I won't remember that"]stringByAppendingString:@"\n" ]; + [self.switch1 setOn:NO animated:YES]; + } + else{ + read =[[read stringByAppendingString:@"What a short name!"]stringByAppendingString:@"\n" ]; + [self.switch1 setOn:YES animated:YES]; + } + if([textField2Value isEqualToString:@"Pizza"] || [textField2Value isEqualToString:@"pizza"]){ + read =[[read stringByAppendingString:@"Nice, mine too!"]stringByAppendingString:@"\n" ]; + //NSLog(@"Nice, mine too!"); + [self.switch2 setOn:YES animated:YES]; + } + else{ + read =[[read stringByAppendingString:@"HAHA, no way, pizza is MUCHH better"]stringByAppendingString:@"\n" ]; + //NSLog(@"HAHA, no way, pizza is MUCHH better"); + [self.switch2 setOn:NO animated:YES]; + } + if(age < 20){ + read =[[read stringByAppendingString:@"Haha, little baby"]stringByAppendingString:@"\n" ]; + //NSLog(@"Haha, little baby"); + [self.switch3 setOn:NO animated:YES]; + } + else{ + read =[[read stringByAppendingString:@"Damn you look older..awkwardd"]stringByAppendingString:@"\n" ]; + //NSLog(@"Damn you look older..awkwardd"); + [self.switch3 setOn:YES animated:YES]; + } + + int count = 0; + + if(self.switch1.on){ + count++; + } + if(self.switch2.on){ + count++; + } + if(self.switch3.on){ + count++; + } + + NSString *countResp =@""; + if(count==0){ + countResp = [countResp stringByAppendingString:@"Damn 0 switches?! Haha that sucks\n"]; + } + if(count==1){ + countResp = [countResp stringByAppendingString:@"Well I guess 1 switch is better than none..but not really\n"]; + } + if(count==2){ + countResp = [countResp stringByAppendingString:@"Whoa 2 switches?! BAD-ASS\n"]; + } + if(count==3){ + countResp = [countResp stringByAppendingString:@"Look at you getting all 3 switches!!Awesome stuff!\n"]; + } + + countResp = [countResp stringByAppendingString:read]; + self.labelOutput.text = countResp; + read =@""; + countResp =@""; + count = 0; + } + + @end