Skip to content

Commit

Permalink
[FEAT]✨ #177 UI 구현완료
Browse files Browse the repository at this point in the history
  • Loading branch information
comeheredart committed Mar 7, 2022
1 parent 3fccc01 commit 426d09c
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 20 deletions.
143 changes: 133 additions & 10 deletions ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/SettingScene/ChangeImageVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,146 @@ import UIKit

class ChangeImageVC: UIViewController {


static let identifier = "ChangeImageVC"

let userWidth = UIScreen.main.bounds.width
let userheight = UIScreen.main.bounds.height

//headerView
private let settingBackgroundView = UIView().then {
$0.backgroundColor = UIColor.white
}
private let headerTitleLabel = UILabel().then {
$0.text = "프로필 수정"
$0.font = UIFont.notoSansRegularFont(ofSize: 17)
$0.textColor = UIColor.black
$0.textAlignment = .center
}
private let backButton = UIButton().then {
$0.setBackgroundImage(UIImage(named: "backIcon"), for: .normal)
$0.addTarget(self, action: #selector(backButtonClicked), for: .touchUpInside)
}
private let doneButton = UIButton().then {
$0.setTitle("완료", for: .normal)
$0.titleLabel?.font = UIFont.notoSansRegularFont(ofSize: 17)
$0.setTitleColor(.gray40, for: .normal)
}
private let bottomView = UIView().then {
$0.backgroundColor = UIColor.gray20
}

private let profileView = UIImageView().then {
$0.image = UIImage(named: "icProfile")
$0.clipsToBounds = true
$0.layer.cornerRadius = 95 / 2
}

private let profileChangeButton = UIButton().then {
$0.setTitle("프로필 사진 바꾸기", for: .normal)
$0.setTitleColor(.mainBlue, for: .normal)
$0.titleLabel?.font = UIFont.notoSansRegularFont(ofSize: 14)
$0.addTarget(self, action: #selector(profileChangeButtonClicked), for: .touchUpInside)
}

private let nicknameInputView = JoinInputView(title: "",
subTitle: "닉네임",
placeholder: "기존 닉네임")



//MARK: - Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setHeaderLayout()
}

@objc private func backButtonClicked() {
self.navigationController?.popViewController(animated: true)
}

@objc private func profileChangeButtonClicked() {

let actionsheetController = UIAlertController(title: "타이틀이담마", message: "메세지담마", preferredStyle: .actionSheet)


let actionDefault = UIAlertAction(title: "액션 디폴트", style: .default, handler: { action in
print("디폴트 action called")
})
let actionDestructive = UIAlertAction(title: "액션 디스트뤕티브", style: .destructive, handler: { action in
print("destructive action called")
})
let actionCancel = UIAlertAction(title: "액션 캔슬", style: .cancel, handler: { action in
print("캔슬 action called")
})

actionsheetController.addAction(actionDefault)
actionsheetController.addAction(actionDestructive)
actionsheetController.addAction(actionCancel)

self.present(actionsheetController, animated: true)

print("왈왈")
}


//MARK: - Configure UI
func setHeaderLayout() {
let headerHeigth = userheight * 0.15
self.view.addSubview(settingBackgroundView)
settingBackgroundView.addSubviews([headerTitleLabel,
backButton,
doneButton,
bottomView,
profileView,
profileChangeButton,
nicknameInputView])

settingBackgroundView.snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview().offset(0)
$0.height.equalTo(headerHeigth)
}
headerTitleLabel.snp.makeConstraints {
$0.centerX.equalTo(settingBackgroundView.snp.centerX)
$0.bottom.equalToSuperview().offset(-25)
$0.width.equalTo(170)
}
backButton.snp.makeConstraints {
$0.width.height.equalTo(48)
$0.leading.equalToSuperview().offset(0)
$0.centerY.equalTo(headerTitleLabel)
}
bottomView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview().offset(0)
$0.height.equalTo(1)
}
doneButton.snp.makeConstraints {
$0.width.height.equalTo(48)
$0.trailing.equalToSuperview().offset(-20)
$0.centerY.equalTo(headerTitleLabel)
}

profileView.snp.makeConstraints {
$0.top.equalTo(settingBackgroundView.snp.bottom).offset(25)
$0.centerX.equalToSuperview()
$0.width.height.equalTo(95)
}

profileChangeButton.snp.makeConstraints {
$0.top.equalTo(profileView.snp.bottom).offset(18)
$0.centerX.equalToSuperview()
$0.height.equalTo(19)
$0.width.equalTo(200)
}

nicknameInputView.snp.makeConstraints {
$0.top.equalTo(profileChangeButton.snp.bottom).offset(20)
$0.leading.equalToSuperview().offset(20)
$0.trailing.equalToSuperview().offset(-20)
$0.height.equalTo(100)
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/


}

112 changes: 102 additions & 10 deletions ChaRo-iOS/ChaRo-iOS/Source/Views/VCs/SettingScene/ChangePasswordVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,115 @@ import UIKit

class ChangePasswordVC: UIViewController {

//MARK: - Properties
static let identifier = "ChangePasswordVC"

let userWidth = UIScreen.main.bounds.width
let userheight = UIScreen.main.bounds.height

//headerView
private let settingBackgroundView = UIView().then {
$0.backgroundColor = UIColor.white
}
private let headerTitleLabel = UILabel().then {
$0.text = "비밀번호 수정"
$0.font = UIFont.notoSansRegularFont(ofSize: 17)
$0.textColor = UIColor.black
$0.textAlignment = .center
}
private let backButton = UIButton().then {
$0.setBackgroundImage(UIImage(named: "backIcon"), for: .normal)
$0.addTarget(self, action: #selector(backButtonClicked), for: .touchUpInside)
}
private let doneButton = UIButton().then {
$0.setTitle("완료", for: .normal)
$0.titleLabel?.font = UIFont.notoSansRegularFont(ofSize: 17)
$0.setTitleColor(.gray40, for: .normal)
}
private let bottomView = UIView().then {
$0.backgroundColor = UIColor.gray20
}

//passwordView
let oldPasswordInputView = JoinInputView(title: "",
subTitle: "기존 비밀번호",
placeholder: "5이상 15자 이내의 영문과 숫자").then {
$0.subTitleLabel.textColor = .gray50
}

let newPasswordInputView = PasswordView(title: "새 비밀번호",
subTitle: "5자 이상 15자 이내의 비밀번호를 입력해주세요.").then {
$0.titleLabel.font = .notoSansRegularFont(ofSize: 12)
}


//MARK: - Life Cycle
override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
setHeaderLayout()

}


@objc private func backButtonClicked() {
self.navigationController?.popViewController(animated: true)
}


//MARK: - Configure UI
private func setHeaderLayout() {
let headerHeigth = userheight * 0.15

self.view.addSubview(settingBackgroundView)

settingBackgroundView.addSubviews([headerTitleLabel,
backButton,
doneButton,
bottomView,
oldPasswordInputView,
newPasswordInputView])

settingBackgroundView.snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview()
$0.height.equalTo(headerHeigth)
}
headerTitleLabel.snp.makeConstraints {
$0.centerX.equalTo(settingBackgroundView)
$0.bottom.equalToSuperview().offset(-25)
$0.width.equalTo(170)
}
backButton.snp.makeConstraints {
$0.width.height.equalTo(48)
$0.leading.equalToSuperview()
$0.centerY.equalTo(headerTitleLabel)
}
bottomView.snp.makeConstraints {
$0.leading.trailing.bottom.equalToSuperview()
$0.height.equalTo(1)
}
doneButton.snp.makeConstraints {
$0.width.height.equalTo(48)
$0.trailing.equalToSuperview().offset(-20)
$0.centerY.equalTo(headerTitleLabel)
}

oldPasswordInputView.snp.makeConstraints {
$0.top.equalTo(settingBackgroundView.snp.bottom).offset(26)
$0.leading.equalToSuperview().offset(20)
$0.trailing.equalToSuperview().offset(-20)
$0.height.equalTo(100)
}

newPasswordInputView.snp.makeConstraints {
$0.top.equalTo(oldPasswordInputView.snp.bottom).offset(63)
$0.leading.equalToSuperview().offset(20)
$0.trailing.equalToSuperview().offset(-20)
$0.height.equalTo(300)
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/




}

0 comments on commit 426d09c

Please sign in to comment.