Skip to content

Commit

Permalink
✨[FEAT] 데이터 전달 및 화면전환 구현(#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed Oct 7, 2021
1 parent 1b4320d commit 793114c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
let navigationController = UINavigationController(rootViewController: CompleteVC())
let navigationController = UINavigationController(rootViewController: LoginVC())
window?.rootViewController = navigationController
window?.backgroundColor = .white
window?.makeKeyAndVisible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class CompleteVC: UIViewController {
private var welcomeLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 35)
$0.textColor = .black
$0.text = "000님\n환영합니다!"
$0.textAlignment = .center
$0.numberOfLines = 2
}
Expand All @@ -41,6 +40,7 @@ class CompleteVC: UIViewController {
super.viewDidLoad()
configUI()
setupAutoLayout()
setupData()
}

// MARK: - Custom Method
Expand Down Expand Up @@ -70,6 +70,13 @@ class CompleteVC: UIViewController {
}
}

func setupData() {
if let name = name {
welcomeLabel.text = "\(name)\n환영합니다!"
}
}

// MARK: - @objc
@objc func touchupCompleteButton(_ sender: UIButton) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ class LoginVC: UIViewController {

let nameTextField = UITextField().then {
$0.setTextField(placeholder: "이름을 입력해주세요", secure: false)
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged)
}

let emailTextField = UITextField().then {
$0.setTextField(placeholder: "이메일 또는 휴대전화", secure: false)
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged)
}

let pwTextField = UITextField().then {
$0.setTextField(placeholder: "비밀번호 입력", secure: true)
$0.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged)
}

lazy var signupButton = UIButton().then {
Expand All @@ -62,10 +65,11 @@ class LoginVC: UIViewController {
}

lazy var signInButton = UIButton().then {
$0.isUserInteractionEnabled = false
$0.setTitle("다음", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.titleLabel?.font = .boldSystemFont(ofSize: 18)
$0.backgroundColor = .mainBlue
$0.backgroundColor = .lightGray
$0.layer.cornerRadius = 10
$0.addTarget(self, action: #selector(touchupSignInButton(_:)), for: .touchUpInside)
}
Expand Down Expand Up @@ -133,14 +137,35 @@ class LoginVC: UIViewController {
}

// MARK: - @objc
@objc func textFieldDidChange(textField: UITextField){
guard let name = nameTextField.text,
let email = emailTextField.text,
let pw = pwTextField.text else {
return
}

if name.isEmpty || email.isEmpty || pw.isEmpty {
signInButton.isUserInteractionEnabled = false
signInButton.backgroundColor = .lightGray
print("비활성화")

} else {
signInButton.isUserInteractionEnabled = true
signInButton.backgroundColor = .mainBlue
print("활성화")
}
}

@objc func touchupSignupButton(_ sender: UIButton) {
let vc = SignUpVC()
navigationController?.pushViewController(vc, animated: true)
}

@objc func touchupSignInButton(_ sender: UIButton) {

let vc = CompleteVC()
vc.name = nameTextField.text
vc.modalPresentationStyle = .fullScreen
present(vc, animated: true, completion: nil)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ class SignUpVC: UIViewController {
}

@objc func touchupSignupButton(_ sender: UIButton) {

let vc = CompleteVC()
vc.name = nameTextField.text
vc.modalPresentationStyle = .fullScreen
present(vc, animated: true, completion: nil)
}
}

Expand Down

0 comments on commit 793114c

Please sign in to comment.