Skip to content

Commit

Permalink
170828 - 회원가입 사용성 개선 : join 누르면 가입 #207
Browse files Browse the repository at this point in the history
  • Loading branch information
JuneBuug committed Aug 28, 2017
1 parent 340984b commit 69be6ab
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
16 changes: 8 additions & 8 deletions iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="09o-sF-lFm">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16D30" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="09o-sF-lFm">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
Expand Down Expand Up @@ -2017,7 +2017,7 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" returnKeyType="next"/>
<connections>
<action selector="onEmailTextChanged:" destination="KQa-R2-kWD" eventType="editingChanged" id="lNH-re-Khx"/>
</connections>
Expand All @@ -2036,7 +2036,7 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="next" secureTextEntry="YES"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next" secureTextEntry="YES"/>
<connections>
<action selector="onPasswordTextChanged:" destination="KQa-R2-kWD" eventType="editingChanged" id="R8z-bP-hJf"/>
</connections>
Expand All @@ -2049,13 +2049,13 @@
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="비밀번호를 한번 더 입력해주세요." textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="4Rl-PH-Rad">
<rect key="frame" x="62" y="389" width="281" height="30"/>
<rect key="frame" x="66" y="389" width="277" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="wq9-3H-9hB"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="join" secureTextEntry="YES"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="join" secureTextEntry="YES"/>
<connections>
<action selector="onPasswordConfirmTextChanged:" destination="KQa-R2-kWD" eventType="editingChanged" id="K7Y-64-pbj"/>
</connections>
Expand Down Expand Up @@ -2117,10 +2117,10 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
</textField>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="비밀번호와 일치하지 않습니다." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DJb-Gp-tIC">
<rect key="frame" x="62" y="427" width="145.5" height="14.5"/>
<rect key="frame" x="66" y="427" width="145.5" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="1" green="0.47061997649999998" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
Expand All @@ -2143,7 +2143,7 @@
<constraint firstItem="hAM-RL-TaP" firstAttribute="centerY" secondItem="vQS-eu-BK0" secondAttribute="centerY" id="Hmh-9e-cW8"/>
<constraint firstAttribute="trailingMargin" secondItem="kOV-iw-uH9" secondAttribute="trailing" constant="11.5" id="LRJ-wR-EsB"/>
<constraint firstItem="1Vk-M8-5xF" firstAttribute="centerX" secondItem="xmp-Dz-1Qo" secondAttribute="centerX" id="NBt-dI-JGq"/>
<constraint firstItem="4Rl-PH-Rad" firstAttribute="leading" secondItem="ESb-dX-0ZU" secondAttribute="trailing" id="O22-Li-nq8"/>
<constraint firstItem="4Rl-PH-Rad" firstAttribute="leading" secondItem="ESb-dX-0ZU" secondAttribute="trailing" constant="4" id="O22-Li-nq8"/>
<constraint firstItem="lwj-zI-BFf" firstAttribute="centerX" secondItem="xmp-Dz-1Qo" secondAttribute="centerX" id="WPc-tB-lRH"/>
<constraint firstAttribute="trailingMargin" secondItem="cCO-g4-bVI" secondAttribute="trailing" constant="16" id="YXB-eL-Jz0"/>
<constraint firstItem="TBO-lJ-IOE" firstAttribute="top" secondItem="0h0-dB-PrQ" secondAttribute="bottom" constant="70" id="bO0-4L-dhc"/>
Expand Down
31 changes: 30 additions & 1 deletion iOSProject/pyunrihae/pyunrihae/SignupViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
import UIKit
import FirebaseAuth
class SignupViewController: UIViewController {
class SignupViewController: UIViewController, UITextFieldDelegate{
@IBOutlet weak var passWordConfirmTextField: UITextField!
@IBOutlet weak var passWordTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
Expand All @@ -21,6 +21,15 @@ class SignupViewController: UIViewController {
super.viewDidLoad()
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)

nicknameTextField.delegate = self
nicknameTextField.tag = 0
emailTextField.delegate = self
emailTextField.tag = 1
passWordTextField.delegate = self
passWordTextField.tag = 2
passWordConfirmTextField.delegate = self
passWordConfirmTextField.tag = 3
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
Expand Down Expand Up @@ -66,6 +75,7 @@ class SignupViewController: UIViewController {
}
}
@IBAction func signUp(_ sender: Any) {
// 회원가입이 가능하면
if completeBtn.isEnabled {
// 회원가입 과정을 다 통과하면 user 만듦
if (nicknameTextField.text?.characters.count)! > 10 {
Expand Down Expand Up @@ -102,6 +112,25 @@ class SignupViewController: UIViewController {
}
}
}
}else{
// 회원가입 가능한 상태가 아니면
return
}
}

func textFieldShouldReturn(_ textField: UITextField) -> Bool {

if textField.tag < 3 { // 마지막 필드가 아니면
if let nextField = textField.superview?.viewWithTag(textField.tag + 1) as? UITextField {
nextField.becomeFirstResponder()
} else {
// Not found, so remove keyboard.
textField.resignFirstResponder()
}
}else{
signUp(_: textField)
}

return false
}
}

0 comments on commit 69be6ab

Please sign in to comment.