From 08142682832de3ca71d6aa853488c5c2b40f6804 Mon Sep 17 00:00:00 2001 From: YuJeong Date: Fri, 30 Aug 2024 09:47:17 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20DeleteAccountViewController=20UI=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PLUV/MyPage/DeleteAccountViewController.swift | 88 ++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/PLUV/MyPage/DeleteAccountViewController.swift b/PLUV/MyPage/DeleteAccountViewController.swift index 034a787..b6a594f 100644 --- a/PLUV/MyPage/DeleteAccountViewController.swift +++ b/PLUV/MyPage/DeleteAccountViewController.swift @@ -16,12 +16,20 @@ class DeleteAccountViewController: UIViewController { $0.font = .systemFont(ofSize: 20, weight: .bold) } private let deleteAccountSubLabel = UILabel().then { + $0.text = "계정 삭제 시, 회원 정보와 모든 이용 내역(내 플레이리스트 및 저장한 플레이리스트)이 삭제되며 복구가 불가능합니다." + $0.numberOfLines = 0 $0.textColor = .gray800 $0.font = .systemFont(ofSize: 16) } private let checkView = UIView() - private let checkBoxButton = UIButton() + private let checkBoxButton = UIButton().then { + $0.layer.cornerRadius = 4 + $0.layer.borderWidth = 1 + $0.layer.borderColor = UIColor.gray300.cgColor + $0.backgroundColor = .white + } private let checkLabel = UILabel().then { + $0.text = "위 사항을 모두 확인했으며, 이에 동의합니다." $0.textColor = .gray800 $0.font = .systemFont(ofSize: 16, weight: .medium) } @@ -54,9 +62,87 @@ class DeleteAccountViewController: UIViewController { private func setUI() { self.view.backgroundColor = .white self.navigationItem.setHidesBackButton(true, animated: false) + + self.view.addSubview(deleteAccountView) + deleteAccountView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide) + make.leading.trailing.equalToSuperview() + } + + self.deleteAccountView.addSubview(deleteAccountTitleLabel) + deleteAccountTitleLabel.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview().inset(24) + make.height.equalTo(28) + } + + self.deleteAccountView.addSubview(deleteAccountSubLabel) + deleteAccountSubLabel.snp.makeConstraints { make in + make.top.equalTo(deleteAccountTitleLabel.snp.bottom).offset(12) + make.leading.trailing.bottom.equalToSuperview().inset(24) + make.height.equalTo(66) + } + + self.view.addSubview(checkView) + checkView.snp.makeConstraints { make in + make.top.equalTo(deleteAccountView.snp.bottom).offset(12) + make.leading.trailing.equalToSuperview() + } + + self.checkView.addSubview(checkBoxButton) + checkBoxButton.addTarget(self, action: #selector(clickCheckBoxButton(_:)), for: .touchUpInside) + checkBoxButton.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(14) + make.leading.equalToSuperview().inset(24) + make.width.height.equalTo(24) + } + + self.checkView.addSubview(checkLabel) + checkLabel.snp.makeConstraints { make in + make.leading.equalTo(checkBoxButton.snp.trailing).offset(10) + make.top.bottom.equalToSuperview().inset(14) + make.trailing.equalToSuperview().inset(24) + make.height.equalTo(22) + } + + self.view.addSubview(deleteAccountButton) + deleteAccountButton.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(24) + make.bottom.equalToSuperview().inset(40+49) + make.height.equalTo(48) + } + + deleteAccountButton.isEnabled = false + deleteAccountButton.setTitle("회원 탈퇴하기", for: .normal) + deleteAccountButton.addTarget(self, action: #selector(clickDeleteAccountButton), for: .touchUpInside) } @objc private func clickBackButton() { self.navigationController?.popViewController(animated: true) } + + @objc func clickCheckBoxButton(_ sender: UIButton) { + if sender.isSelected { + sender.isSelected = false + sender.layer.borderWidth = 1 + sender.layer.borderColor = UIColor.gray300.cgColor + sender.setImage(nil, for: .normal) + sender.backgroundColor = .white + deleteAccountButton.isEnabled = false + } else { + sender.isSelected = true + sender.layer.borderWidth = 0 + if let selectedImage = UIImage(named: "check_image")?.withRenderingMode(.alwaysTemplate) { + let resizedImage = selectedImage.resizeButtonImage(targetSize: CGSize(width: 16, height: 16)) + sender.setImage(resizedImage, for: .normal) + sender.tintColor = .white + sender.contentMode = .scaleAspectFit + } + sender.backgroundColor = .black + deleteAccountButton.isEnabled = true + } + } + + @objc func clickDeleteAccountButton() { + print("clickDeleteAccountButton 확인") + } }