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
12 changes: 12 additions & 0 deletions HelloWorld/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@ import UIKit

class ViewController: UIViewController {

@IBOutlet weak var nameTextfield: UITextField!

@IBOutlet weak var greetingLabel: UILabel!

@IBAction func sayHellobuttonPressed(sender: AnyObject) {
if let name = nameTextfield.text {
greetingLabel.text = "Hello, \(name)"
} else {
greetingLabel.text = "Hello, World!"
}

}
}

39 changes: 38 additions & 1 deletion HelloWorld/main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -16,11 +17,47 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Hello World" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="q0w-zn-yFS">
<rect key="frame" x="105" y="229" width="89" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mya-M1-MvT">
<rect key="frame" x="88" y="139" width="123" height="30"/>
<state key="normal" title="Say Hello!"/>
<connections>
<action selector="sayHellobuttonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Zzq-Dh-HNv"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="JCm-ys-vE3">
<rect key="frame" x="114" y="51" width="97" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="q0w-zn-yFS" secondAttribute="trailing" id="3fX-HO-esN"/>
<constraint firstItem="JCm-ys-vE3" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="3iR-Ve-Qxv"/>
<constraint firstItem="Mya-M1-MvT" firstAttribute="top" secondItem="JCm-ys-vE3" secondAttribute="bottom" constant="20" id="4GI-BK-BhG"/>
<constraint firstAttribute="trailingMargin" secondItem="JCm-ys-vE3" secondAttribute="trailing" id="8zx-LM-dFs"/>
<constraint firstItem="q0w-zn-yFS" firstAttribute="top" secondItem="Mya-M1-MvT" secondAttribute="bottom" constant="20" id="PqX-Y1-MGG"/>
<constraint firstItem="JCm-ys-vE3" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="20" id="Y2g-Aj-YI5"/>
<constraint firstItem="Mya-M1-MvT" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="cHV-0D-CcU"/>
<constraint firstItem="q0w-zn-yFS" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="cVw-QD-k29"/>
<constraint firstAttribute="trailingMargin" secondItem="Mya-M1-MvT" secondAttribute="trailing" id="r7v-UC-Xbl"/>
</constraints>
</view>
<connections>
<outlet property="greetingLabel" destination="q0w-zn-yFS" id="ZgS-3G-0EZ"/>
<outlet property="nameTextfield" destination="JCm-ys-vE3" id="Eje-Vt-xfu"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="433" y="188"/>
</scene>
</scenes>
</document>