-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Second assignment #2
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## 🛠 Issue | ||
<!-- 이슈에 대해 간략하게 설명해주세요 --> | ||
|
||
## 📋 To-do | ||
<!-- 진행할 작업에 대해 적어주세요 --> | ||
- [ ] todo! | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 🔥 Pull requests | ||
## 🌴 작업한 브랜치 | ||
- # 이슈넘버 적어주세용 | ||
|
||
## ✅ 작업한 내용 | ||
- 작업한 내용 작성하세용 | ||
|
||
## 💁🏻♂️ 추가한 기능 | ||
- 추가한 기능 작성하세용 | ||
|
||
## 🧗🏻 추가할 기능 | ||
- 추가해야할 기능 작성하세용 | ||
|
||
## 📸 스크린샷 | ||
스크린샷 첨부해주세용 | ||
|
||
closed #이슈넘버 적어주세용 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# NOHHANSOL | ||
# BaeSungho | ||
|
||
|
||
|
||
![gitbanner_hansol](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m86nwttxj22aj0hiabx.jpg) | ||
|
||
![curri](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m8g413dwj21hc0u0dja.jpg) | ||
|
||
![gitbanner_sungho](https://user-images.githubusercontent.com/45239582/193579660-2944d5c1-81e1-4e8e-b91f-55528cc1f595.png) | ||
|
||
![curri](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m8g413dwj21hc0u0dja.jpg) |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Group 121.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Group 121@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Group 121@3x.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// CheckAccount.swift | ||
// first assignment | ||
// | ||
// Created by saint on 2022/10/03. | ||
// | ||
|
||
import UIKit | ||
|
||
class CheckAccount: UIViewController { | ||
|
||
private let helloLabel: UILabel = { | ||
let label = UILabel(frame: CGRect(x: 45, y: 300, width: 300, height: 60)) | ||
label.numberOfLines = 2 | ||
label.text = "000님\n환영합니다" | ||
label.font = .systemFont(ofSize: 20, weight: .bold) | ||
label.textColor = .black | ||
label.textAlignment = .center | ||
return label | ||
}() | ||
|
||
private let acceptButton: UIButton = { | ||
let button = UIButton(frame: CGRect(x: 45, y: 415, width: 300, height: 40)) | ||
button.setTitle("확인", for: .normal) | ||
button.setTitleColor(.black, for: .normal) | ||
button.titleLabel?.font = .systemFont(ofSize: 16, weight: .bold) | ||
button.backgroundColor = .systemYellow | ||
button.addTarget(self, action: #selector(touchupOkayButton), for: .touchUpInside) | ||
return button | ||
}() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.backgroundColor = .white | ||
|
||
let components: [Any] = [helloLabel, acceptButton] | ||
components.forEach{ | ||
view.addSubview($0 as! UIView) | ||
} | ||
Comment on lines
+34
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. viewDidLoad와 같은 생명주기 함수 내에서는 보통 메소드 호출을 해주는 것이 가독성에도 더 좋고 코드가 깔끔해진다고 생각합니다❗️개인적인 의견이니 참고만 해주세요 ~! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵~😄 |
||
} | ||
|
||
func showText(email: String){ | ||
helloLabel.text = "당신의 선택은 \(email)였군요!" | ||
} | ||
|
||
@objc | ||
private func touchupOkayButton(){ | ||
if self.navigationController == nil{ | ||
self.dismiss(animated: true, completion: nil) | ||
} | ||
else{ | ||
self.navigationController?.popViewController(animated: true) | ||
} | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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>UIApplicationSceneManifest</key> | ||
<dict> | ||
<key>UIApplicationSupportsMultipleScenes</key> | ||
<false/> | ||
<key>UISceneConfigurations</key> | ||
<dict> | ||
<key>UIWindowSceneSessionRoleApplication</key> | ||
<array> | ||
<dict> | ||
<key>UISceneConfigurationName</key> | ||
<string>Default Configuration</string> | ||
<key>UISceneDelegateClassName</key> | ||
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// KakaoTextField.swift | ||
// first_assignment | ||
// | ||
// Created by saint on 2022/10/03. | ||
// | ||
|
||
/// text field를 만들 때, 텍스트+밑줄을 한꺼번에 만드는 class | ||
import UIKit | ||
|
||
class KakaoCustomView: UIView { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 커스텀뷰 사용 너무 좋네요👍 |
||
|
||
let nameTextField: UITextField = { | ||
let textField = UITextField(frame: CGRect(x: 0, y: 0, width: 300, height: 39)) | ||
return textField | ||
}() | ||
|
||
private let underLineView: UIView = { | ||
let view = UIView(frame: CGRect(x: 0, y: 39, width: 300, height: 1)) | ||
view.backgroundColor = .systemGray4 | ||
return view | ||
}() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
[nameTextField, underLineView].forEach { | ||
self.addSubview($0) | ||
} | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func dataBind(placeholder: String) { | ||
nameTextField.placeholder = placeholder | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// | ||
// MainAccount.swift | ||
// first assignment | ||
// | ||
// Created by saint on 2022/10/03. | ||
// | ||
|
||
import UIKit | ||
|
||
class LoginMenu: UIViewController { | ||
|
||
static let height : Int = 40 | ||
|
||
private let startLabel: UILabel = { | ||
let label = UILabel(frame: CGRect(x: 90, y: 120, width: UIScreen.main.bounds.width - 60, height: 40)) | ||
label.text = "카카오톡을 시작합니다" | ||
label.font = .systemFont(ofSize: 24, weight: .bold) | ||
return label | ||
}() | ||
|
||
private let introLabel: UILabel = { | ||
|
||
let label = UILabel(frame: CGRect(x: 45, y: 170, width: 300, height: 40 )) | ||
label.numberOfLines = 2 | ||
label.text = "사용하던 카카오계정이 있다면\n이메일 또는 전화번호로 로그인해 주세요." | ||
label.font = .systemFont(ofSize: 12, weight: .medium) | ||
label.textColor = .systemGray | ||
label.textAlignment = .center | ||
return label | ||
}() | ||
|
||
private let emailPhoneTextField: KakaoCustomView = { | ||
let textField = KakaoCustomView(frame: CGRect(x: 45, y: 250, width: 300, height: 40)) | ||
return textField | ||
}() | ||
|
||
private let passwordTextField: KakaoCustomView = { | ||
let textField = KakaoCustomView(frame: CGRect(x: 45, y: 300, width: 300, height: 40)) | ||
return textField | ||
}() | ||
|
||
private func config(){ | ||
emailPhoneTextField.dataBind(placeholder: "이메일 또는 전화번호") | ||
passwordTextField.dataBind(placeholder: "비밀번호") | ||
} | ||
|
||
private let loginButton: UIButton = { | ||
let button = UIButton(frame: CGRect(x: 45, y: 365, width: 300, height: 40)) | ||
button.setTitle("카카오계정 로그인", for: .normal) | ||
button.setTitleColor(.black, for: .normal) | ||
button.titleLabel?.font = .systemFont(ofSize: 16) | ||
button.backgroundColor = .systemGray5 | ||
button.addTarget(self, action: #selector(presentToCheckAccount), for: .touchUpInside) | ||
return button | ||
}() | ||
|
||
private let newAccountButton: UIButton = { | ||
let button = UIButton(frame: CGRect(x: 45, y: 415, width: 300, height: 40)) | ||
button.setTitle("새로운 카카오계정 만들기", for: .normal) | ||
button.setTitleColor(.black, for: .normal) | ||
button.titleLabel?.font = .systemFont(ofSize: 16) | ||
button.backgroundColor = .systemGray5 | ||
//self는 어디서든 main class를 가리킨다. | ||
button.addTarget(self, action: #selector(pushToNewAccount), for: .touchUpInside) | ||
return button | ||
}() | ||
|
||
private let findAccountButton: UIButton = { | ||
let button = UIButton(frame: CGRect(x: 45, y: 465, width: 300, height: 30)) | ||
button.setTitle("카카오계정 또는 비밀번호 찾기", for: .normal) | ||
button.setTitleColor(.black, for: .normal) | ||
button.titleLabel?.font = .systemFont(ofSize: 14) | ||
return button | ||
}() | ||
|
||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.backgroundColor = .white | ||
config() | ||
|
||
let components: [Any] = [startLabel, introLabel, emailPhoneTextField, passwordTextField, loginButton, newAccountButton, findAccountButton] | ||
components.forEach{ | ||
view.addSubview($0 as! UIView) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 따로 빼셔도 좋을 것 같아용~! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 늦게 봤네용 좋은 의견 감사합니당 |
||
} | ||
|
||
@objc | ||
private func pushToNewAccount(){ | ||
let na = NewAccount() | ||
self.navigationController?.pushViewController(na, animated: true) | ||
} | ||
|
||
@objc | ||
private func presentToCheckAccount(){ | ||
let ca = CheckAccount() | ||
ca.modalPresentationStyle = .fullScreen | ||
self.present(ca, animated: true, completion: nil) // animated : true -> 애니메이션을 보이게 하기; completion : 종료 후에 실행할 작업, closer 활용하기 | ||
|
||
if let answer = emailPhoneTextField.nameTextField.text{ | ||
ca.showText(email: answer) | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
보통 파일명과 클래스명의 끝부분에는 상속받는 클래스의 이름(UI 제외)을 붙여주는 것 같아요~! 이 뷰의 경우에는 CheckAccountViewController가 되겠네요