diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..acd8317 Binary files /dev/null and b/.DS_Store differ diff --git a/IfElse/.DS_Store b/IfElse/.DS_Store new file mode 100644 index 0000000..7250d54 Binary files /dev/null and b/IfElse/.DS_Store differ diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/shenayoshida.xcuserdatad/UserInterfaceState.xcuserstate b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/shenayoshida.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..c56ddb3 Binary files /dev/null and b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/shenayoshida.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.xcuserdatad/xcschemes/IfElse.xcscheme b/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.xcuserdatad/xcschemes/IfElse.xcscheme new file mode 100644 index 0000000..6485954 --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.xcuserdatad/xcschemes/IfElse.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.xcuserdatad/xcschemes/xcschememanagement.plist b/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..44aa48b --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/shenayoshida.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..f655fc3 100644 --- a/IfElse/IfElse/Base.lproj/Main.storyboard +++ b/IfElse/IfElse/Base.lproj/Main.storyboard @@ -2,7 +2,6 @@ - @@ -19,74 +18,85 @@ + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -95,26 +105,23 @@ - - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/IfElse/IfElse/ViewController.m b/IfElse/IfElse/ViewController.m index b3ee131..2167bb4 100644 --- a/IfElse/IfElse/ViewController.m +++ b/IfElse/IfElse/ViewController.m @@ -10,18 +10,57 @@ @interface ViewController () +@property (weak, nonatomic) IBOutlet UITextField *text1; +@property (weak, nonatomic) IBOutlet UITextField *text2; +@property (weak, nonatomic) IBOutlet UITextField *text3; +@property (weak, nonatomic) IBOutlet UISwitch *toggle; + + @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)buttonTapped:(id)sender { + NSLog(@"tapped"); + + NSString *text1Value = self.text1.text; + NSLog(@"%@", text1Value); + + NSString *one = self.text1.text; + NSString *two = self.text2.text; + NSString *three = self.text3.text; + + NSString *password = @"threeBananas"; + BOOL correctpassword = [password isEqualToString: three]; + + BOOL twoEqualsThree = [two isEqualToString:three]; + if (twoEqualsThree) { + if (correctpassword == YES) { + [self.toggle setOn:YES animated:YES]; + } + } + else { + [self.toggle setOn:NO animated:YES]; + } + + +// BOOL oneEqualsTwo = [one isEqualToString:two]; +// if (oneEqualsTwo) { +// NSLog(@"first 2 are =="); +// [self.toggle setOn:YES animated:YES]; +// } else { +// [self.toggle setOn:NO animated:YES]; +// } + +// BOOL twoEqualsThree = [two isEqualToString:three]; +// if (twoEqualsThree) { +// NSLog(@"two and three are =="); +// [self.toggle setOn:YES animated:YES]; +// } else { +// [self.toggle setOn:NO animated:YES]; +//} + } @end