From 2fed536baca3333535b618597d394228174d9123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EB=AF=BC?= Date: Mon, 19 Aug 2024 23:02:24 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8D=BC?= =?UTF-8?q?=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../10_CMD_iOS/LoginViewController.swift | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 10_CMD_iOS/10_CMD_iOS/LoginViewController.swift diff --git a/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift b/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift new file mode 100644 index 0000000..e68bf4b --- /dev/null +++ b/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift @@ -0,0 +1,121 @@ +import UIKit +import SnapKit +import Then + + +class LoginViewController: UIViewController { + + let mainLabel = UILabel() .then{ + $0.textColor = .black + $0.text = "로그인" + $0.font = UIFont.systemFont(ofSize:50, weight: .bold) + } + + let subLabel = UILabel() .then{ + $0.textColor = .textField + $0.text = "기존 계정으로 로그인 하세요~" + $0.font = UIFont.systemFont(ofSize:16, weight: .thin) + } + + let idTextField = UITextField() .then{ + $0.placeholder = "아이디" + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.layer.cornerRadius = 18 + $0.addLeftPadding() + } + + let passWordTextField = UITextField() .then{ + $0.placeholder = "비밀번호" + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.cornerRadius = 18 + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.isSecureTextEntry = true + $0.addLeftPadding() + } + + let loginButton = UIButton() .then{ + $0.setTitle("로그인", for: .normal) + $0.layer.cornerRadius = 18 + $0.backgroundColor = .textField + $0.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .regular) + $0.setTitleColor(.black, for: .normal) + } + + let signUpButton = UIButton() .then{ + $0.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .regular) + $0.setTitle("회원가입 하기", for: .normal) + $0.setTitleColor(.textField, for: .normal) + $0.addTarget(nil, action: #selector(signUpButtonTap), for: .touchUpInside) + } + + @objc func signUpButtonTap() { + let nextView = SignUpViewController() + self.navigationController?.pushViewController(nextView, animated: true) + } + + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .white + view.addSubview(mainLabel) + view.addSubview(subLabel) + view.addSubview(idTextField) + view.addSubview(passWordTextField) + view.addSubview(loginButton) + view.addSubview(signUpButton) + + + + mainLabel.snp.makeConstraints{ + $0.top.equalToSuperview().inset(180) + $0.left.equalToSuperview().inset(43) + } + + subLabel.snp.makeConstraints{ + $0.top.equalTo(mainLabel.snp.bottom).offset(15) + $0.left.equalToSuperview().inset(48) + } + + idTextField.snp.makeConstraints{ + $0.top.equalTo(mainLabel.snp.bottom).offset(100) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + passWordTextField.snp.makeConstraints{ + $0.top.equalTo(idTextField.snp.bottom).offset(27) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + loginButton.snp.makeConstraints{ + $0.top.equalTo(passWordTextField.snp.bottom).offset(100) + $0.left.equalToSuperview().inset(44) + $0.right.equalToSuperview().inset(44) + $0.height.equalTo(55) + } + + signUpButton.snp.makeConstraints{ + $0.top.equalTo(loginButton.snp.bottom).offset(48) + $0.centerX.equalToSuperview() + } + } + + +} + +extension UITextField { + func addLeftPadding() { + let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 22, height: self.frame.height)) + self.leftView = paddingView + self.leftViewMode = ViewMode.always + } +} From 355ae5d4b6bc278b351f248eca4afb3e4028c9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EB=AF=BC?= Date: Mon, 19 Aug 2024 23:02:49 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../10_CMD_iOS/SignUpViewController.swift | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 10_CMD_iOS/10_CMD_iOS/SignUpViewController.swift diff --git a/10_CMD_iOS/10_CMD_iOS/SignUpViewController.swift b/10_CMD_iOS/10_CMD_iOS/SignUpViewController.swift new file mode 100644 index 0000000..76439b5 --- /dev/null +++ b/10_CMD_iOS/10_CMD_iOS/SignUpViewController.swift @@ -0,0 +1,148 @@ +import Then +import SnapKit +import UIKit + +class SignUpViewController: UIViewController{ + + let mainLabel = UILabel() .then{ + $0.textColor = .black + $0.text = "회원가입" + $0.font = UIFont.systemFont(ofSize:50, weight: .bold) + } + + let subLabel = UILabel() .then{ + $0.textColor = .textField + $0.text = "새로운 계정을 만들어요~" + $0.font = UIFont.systemFont(ofSize:16, weight: .thin) + } + + let idTextField = UITextField() .then{ + $0.placeholder = "아이디" + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.layer.cornerRadius = 18 + $0.addLeftPadding() + } + + let passWordTextField = UITextField() .then{ + $0.placeholder = "비밀번호" + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.cornerRadius = 18 + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.isSecureTextEntry = true + $0.addLeftPadding() + } + + let checkPassWordTextField = UITextField() .then{ + $0.placeholder = "비밀번호 확인" + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.cornerRadius = 18 + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.isSecureTextEntry = true + $0.addLeftPadding() + } + + let checkTextField = UITextField() .then{ + $0.placeholder = "인증 번호를 입력해주세요." + $0.textColor = .black + $0.font = UIFont.systemFont(ofSize: 20, weight: .regular) + $0.layer.cornerRadius = 18 + $0.layer.borderColor = UIColor.textField.cgColor + $0.layer.borderWidth = 1 + $0.addLeftPadding() + } + + let signUpButton = UIButton() .then{ + $0.setTitle("회원가입", for: .normal) + $0.layer.cornerRadius = 18 + $0.backgroundColor = .textField + $0.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .regular) + $0.setTitleColor(.black, for: .normal) + } + + let loginButton = UIButton() .then{ + $0.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .regular) + $0.setTitle("로그인 하기", for: .normal) + $0.setTitleColor(.textField, for: .normal) + $0.addTarget(nil, action: #selector(loginButtonTap), for: .touchUpInside) + } + + @objc func loginButtonTap() { + let beforeView = LoginViewController() + self.navigationController?.popViewController(animated: true) + } + + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .white + view.addSubview(mainLabel) + view.addSubview(subLabel) + view.addSubview(idTextField) + view.addSubview(passWordTextField) + view.addSubview(signUpButton) + view.addSubview(loginButton) + view.addSubview(checkTextField) + view.addSubview(checkPassWordTextField) + + + mainLabel.snp.makeConstraints{ + $0.top.equalToSuperview().inset(136) + $0.left.equalToSuperview().inset(43) + } + + subLabel.snp.makeConstraints{ + $0.top.equalTo(mainLabel.snp.bottom).offset(15) + $0.left.equalToSuperview().inset(48) + } + + idTextField.snp.makeConstraints{ + $0.top.equalTo(mainLabel.snp.bottom).offset(80) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + passWordTextField.snp.makeConstraints{ + $0.top.equalTo(idTextField.snp.bottom).offset(25) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + checkPassWordTextField.snp.makeConstraints{ + $0.top.equalTo(passWordTextField.snp.bottom).offset(25) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + checkTextField.snp.makeConstraints{ + $0.top.equalTo(checkPassWordTextField.snp.bottom).offset(25) + $0.left.equalToSuperview().inset(38) + $0.right.equalToSuperview().inset(36) + $0.height.equalTo(55) + } + + signUpButton.snp.makeConstraints{ + $0.top.equalTo(checkTextField.snp.bottom).offset(60) + $0.left.equalToSuperview().inset(44) + $0.right.equalToSuperview().inset(44) + $0.height.equalTo(55) + } + + loginButton.snp.makeConstraints{ + $0.top.equalTo(signUpButton.snp.bottom).offset(30) + $0.centerX.equalToSuperview() + } + } + + +} From f1d537327232d63aa7ada9546ec38fce4df54762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EB=AF=BC?= Date: Tue, 20 Aug 2024 16:49:22 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../textField.colorset/Contents.json | 38 +++++++++++++++++++ 10_CMD_iOS/10_CMD_iOS/SceneDelegate.swift | 4 +- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 10_CMD_iOS/10_CMD_iOS/Assets.xcassets/textField.colorset/Contents.json diff --git a/10_CMD_iOS/10_CMD_iOS/Assets.xcassets/textField.colorset/Contents.json b/10_CMD_iOS/10_CMD_iOS/Assets.xcassets/textField.colorset/Contents.json new file mode 100644 index 0000000..0121685 --- /dev/null +++ b/10_CMD_iOS/10_CMD_iOS/Assets.xcassets/textField.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x8D", + "green" : "0x8D", + "red" : "0x8D" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x8D", + "green" : "0x8D", + "red" : "0x8D" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/10_CMD_iOS/10_CMD_iOS/SceneDelegate.swift b/10_CMD_iOS/10_CMD_iOS/SceneDelegate.swift index 3a79e76..f61b706 100644 --- a/10_CMD_iOS/10_CMD_iOS/SceneDelegate.swift +++ b/10_CMD_iOS/10_CMD_iOS/SceneDelegate.swift @@ -15,8 +15,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let scene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: scene) - let viewController = ViewController() - window?.rootViewController = viewController + let loginViewController = LoginViewController() + window?.rootViewController = UINavigationController(rootViewController: loginViewController) window?.makeKeyAndVisible() } From c94d96c129b93df23da64470ee4d0046f84f9857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EB=AF=BC?= Date: Tue, 20 Aug 2024 16:49:50 +0900 Subject: [PATCH 4/4] =?UTF-8?q?space=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10_CMD_iOS/10_CMD_iOS/LoginViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift b/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift index e68bf4b..57f23a2 100644 --- a/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift +++ b/10_CMD_iOS/10_CMD_iOS/LoginViewController.swift @@ -27,7 +27,7 @@ class LoginViewController: UIViewController { $0.addLeftPadding() } - let passWordTextField = UITextField() .then{ + let passWordTextField = UITextField().then{ $0.placeholder = "비밀번호" $0.textColor = .black $0.font = UIFont.systemFont(ofSize: 20, weight: .regular)