Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added IfElse/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE64011B22A54400D3D7AA"
BuildableName = "IfElseTests.xctest"
BlueprintName = "IfElseTests"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE64011B22A54400D3D7AA"
BuildableName = "IfElseTests.xctest"
BlueprintName = "IfElseTests"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE63E81B22A54400D3D7AA"
BuildableName = "IfElse.app"
BlueprintName = "IfElse"
ReferencedContainer = "container:IfElse.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>IfElse.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8DFE63E81B22A54400D3D7AA</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>8DFE64011B22A54400D3D7AA</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
64 changes: 64 additions & 0 deletions IfElse/IfElse/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -35,6 +36,9 @@
<include reference="Zqi-Kp-0sb"/>
</mask>
</variation>
<connections>
<action selector="buttonTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="9Om-k5-LO8"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iGu-Ut-VER">
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
Expand All @@ -50,7 +54,43 @@
<rect key="frame" x="0.0" y="-30" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<variation key="widthClass=compact" misplaced="YES">
<rect key="frame" x="16" y="75" width="368" height="30"/>
</variation>
</textField>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NNE-fI-64l">
<rect key="frame" x="-25" y="-15" width="51" height="31"/>
<variation key="widthClass=compact" misplaced="YES">
<rect key="frame" x="176" y="289" width="51" height="31"/>
</variation>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="gOq-Ht-PXa">
<rect key="frame" x="0.0" y="-21" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="16" y="-1" width="42" height="21"/>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="nic-67-V1k">
<rect key="frame" x="0.0" y="-21" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="16" y="58" width="42" height="21"/>
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Confirm Password" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="77g-1S-Kin">
<rect key="frame" x="0.0" y="-21" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="widthClass=compact" fixedFrame="YES">
<rect key="frame" x="16" y="120" width="42" height="21"/>
</variation>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
Expand All @@ -59,7 +99,9 @@
<constraint firstItem="aB7-bV-Euy" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="FUk-zx-HHm"/>
<constraint firstItem="NHM-gg-8tT" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="KoG-0I-h8P"/>
<constraint firstItem="aB7-bV-Euy" firstAttribute="top" secondItem="iGu-Ut-VER" secondAttribute="bottom" constant="30" id="NaR-3r-PFr"/>
<constraint firstAttribute="centerY" secondItem="NNE-fI-64l" secondAttribute="centerY" id="VF9-zP-Qus"/>
<constraint firstItem="iGu-Ut-VER" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="YG0-rg-2K5"/>
<constraint firstAttribute="centerX" secondItem="NNE-fI-64l" secondAttribute="centerX" id="YYy-9B-kdg"/>
<constraint firstItem="z7z-6R-wIs" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="dAR-uW-kvy"/>
<constraint firstItem="aB7-bV-Euy" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="pIc-Dd-VL9"/>
<constraint firstItem="z7z-6R-wIs" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="rJf-e4-gKp"/>
Expand All @@ -73,6 +115,10 @@
<exclude reference="iGu-Ut-VER"/>
<exclude reference="NHM-gg-8tT"/>
<exclude reference="aB7-bV-Euy"/>
<exclude reference="NNE-fI-64l"/>
<exclude reference="gOq-Ht-PXa"/>
<exclude reference="nic-67-V1k"/>
<exclude reference="77g-1S-Kin"/>
</mask>
<mask key="constraints">
<exclude reference="8TF-Rc-kG4"/>
Expand All @@ -84,6 +130,8 @@
<exclude reference="4m5-pb-omc"/>
<exclude reference="KoG-0I-h8P"/>
<exclude reference="vUU-ID-K6d"/>
<exclude reference="VF9-zP-Qus"/>
<exclude reference="YYy-9B-kdg"/>
<exclude reference="dAR-uW-kvy"/>
<exclude reference="rJf-e4-gKp"/>
<exclude reference="u61-Ws-DaA"/>
Expand All @@ -95,6 +143,10 @@
<include reference="iGu-Ut-VER"/>
<include reference="NHM-gg-8tT"/>
<include reference="aB7-bV-Euy"/>
<include reference="NNE-fI-64l"/>
<include reference="gOq-Ht-PXa"/>
<include reference="nic-67-V1k"/>
<include reference="77g-1S-Kin"/>
</mask>
<mask key="constraints">
<include reference="8TF-Rc-kG4"/>
Expand All @@ -106,15 +158,27 @@
<include reference="4m5-pb-omc"/>
<include reference="KoG-0I-h8P"/>
<include reference="vUU-ID-K6d"/>
<include reference="VF9-zP-Qus"/>
<include reference="YYy-9B-kdg"/>
<include reference="dAR-uW-kvy"/>
<include reference="rJf-e4-gKp"/>
<include reference="u61-Ws-DaA"/>
</mask>
</variation>
</view>
<connections>
<outlet property="label1" destination="gOq-Ht-PXa" id="nqe-q2-L5D"/>
<outlet property="label2" destination="nic-67-V1k" id="Gdi-KI-4p9"/>
<outlet property="label3" destination="77g-1S-Kin" id="9qb-R5-LWn"/>
<outlet property="textField1" destination="iGu-Ut-VER" id="AtM-Sn-E5X"/>
<outlet property="textField2" destination="aB7-bV-Euy" id="9w9-yG-O7W"/>
<outlet property="textField3" destination="NHM-gg-8tT" id="JJb-EH-RKQ"/>
<outlet property="toggle" destination="NNE-fI-64l" id="y0D-UZ-bmo"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="349.5" y="337"/>
</scene>
</scenes>
</document>
43 changes: 35 additions & 8 deletions IfElse/IfElse/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,45 @@

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *label1;
@property (weak, nonatomic) IBOutlet UILabel *label2;
@property (weak, nonatomic) IBOutlet UILabel *label3;

@property (weak, nonatomic) IBOutlet UITextField *textField1;
@property (weak, nonatomic) IBOutlet UITextField *textField2;
@property (weak, nonatomic) IBOutlet UITextField *textField3;
@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 *one = self.textField1.text;
NSString *two = self.textField2.text;
NSString *three = self.textField3.text;


BOOL oneEqualsTwo = [one isEqualToString:two];
BOOL twoEqualsThree = [two isEqualToString:three];


if (twoEqualsThree) {
[self.toggle setOn:YES animated:YES];
NSLog(@"Welcome!");
} else if (oneEqualsTwo) {
[self.toggle setOn:NO animated:YES];
NSLog(@"Please maker sure your password is different from you username!");
} else {
[self.toggle setOn:NO animated:YES];
NSLog(@"Please make sure you enter the same password!");
}


}

@end