Skip to content

Commit

Permalink
✅[CHORE] CompleteVC layout 수정(#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed Oct 18, 2021
1 parent f35aae6 commit d53a34d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,32 @@ class CompleteVC: UIViewController {
// MARK: - Properties
var name: String?

private var logoLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 50)
$0.textColor = .mainBlue
$0.text = "Google"
private let logoImageView = UIImageView().then {
$0.image = Const.Image.logo
$0.contentMode = .scaleAspectFit
}

private var welcomeLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 35)
$0.textColor = .black
private let welcomeLabel = UILabel().then {
$0.font = .systemFont(ofSize: 26, weight: .semibold)
$0.textAlignment = .center
$0.numberOfLines = 0
}

private let completeButton = UIButton().then {
$0.setTitle("확인", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.titleLabel?.font = .boldSystemFont(ofSize: 18)
$0.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium)
$0.backgroundColor = .mainBlue
$0.layer.cornerRadius = 10
$0.layer.cornerRadius = 4
$0.addTarget(self, action: #selector(touchupCompleteButton(_:)), for: .touchUpInside)
}

private let logoutButton = UIButton().then {
$0.setTitle("로그아웃", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.titleLabel?.font = .boldSystemFont(ofSize: 18)
$0.backgroundColor = .mainBlue
$0.layer.cornerRadius = 10
$0.addTarget(self, action: #selector(touchupLogoutButton(_:)), for: .touchUpInside)
private let anotherAccountButton = UIButton().then {
$0.setTitle("다른 계정으로 로그인하기", for: .normal)
$0.titleLabel?.font = .systemFont(ofSize: 14, weight: .medium)
$0.setTitleColor(.mainBlue, for: .normal)
$0.setTitleColor(.white, for: .highlighted)
$0.addTarget(self, action: #selector(touchupAnotherAccountButton(_:)), for: .touchUpInside)
}

// MARK: - Lifecycle
Expand All @@ -61,37 +58,36 @@ class CompleteVC: UIViewController {
}

func setupAutoLayout() {
view.addSubviews([logoLabel, welcomeLabel, completeButton, logoutButton])
view.addSubviews([logoImageView, welcomeLabel, completeButton, anotherAccountButton])

logoLabel.snp.makeConstraints { make in
make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).inset(100)
logoImageView.snp.makeConstraints { make in
make.top.equalToSuperview().inset(216)
make.centerX.equalToSuperview()
}

welcomeLabel.snp.makeConstraints { make in
make.top.equalTo(logoLabel.snp.bottom).offset(40)
make.leading.trailing.equalToSuperview().inset(80)
make.top.equalTo(logoImageView.snp.bottom).offset(23)
make.leading.trailing.equalToSuperview().inset(22)
make.centerX.equalToSuperview()
}

completeButton.snp.makeConstraints { make in
make.top.equalTo(welcomeLabel.snp.bottom).offset(80)
make.leading.trailing.equalToSuperview().inset(30)
make.width.equalTo(80)
make.height.equalTo(50)
make.top.equalTo(welcomeLabel.snp.bottom).offset(53)
make.leading.trailing.equalToSuperview().inset(22)
make.height.equalTo(42)
}

logoutButton.snp.makeConstraints { make in
make.top.equalTo(completeButton.snp.bottom).offset(20)
make.leading.trailing.equalToSuperview().inset(30)
make.width.equalTo(80)
make.height.equalTo(50)
anotherAccountButton.snp.makeConstraints { make in
make.top.equalTo(completeButton.snp.bottom).offset(23)
make.leading.trailing.equalToSuperview().inset(22)
make.height.equalTo(22)
}
}

func setupData() {
if let name = name {
welcomeLabel.text = "\(name)\n환영합니다!"
welcomeLabel.addSpacing(kernValue: 0, paragraphValue: 8)
}
}

Expand All @@ -100,7 +96,7 @@ class CompleteVC: UIViewController {

}

@objc func touchupLogoutButton(_ sender: UIButton) {
@objc func touchupAnotherAccountButton(_ sender: UIButton) {
do { // 로그아웃
try FirebaseAuth.Auth.auth().signOut()
guard let pvc = presentingViewController as? UINavigationController else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class SignUpVC: UIViewController {

FirebaseAuth.Auth.auth().createUser(withEmail: email, password: pw) { [self] (result, error) in
if error != nil { // error가 nil이 아니다 => error에 뭐가 있다? => error가 있다는 뜻
print("회원가입 실패")
print("회원가입 실패", error?.localizedDescription)

} else {
// 데이터 추가
Expand Down

0 comments on commit d53a34d

Please sign in to comment.