Skip to content

Commit

Permalink
#73 Fix: 오토레이아웃 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SOOHYUNLEE08 committed Aug 20, 2024
1 parent 26492e9 commit f2ef874
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 34 deletions.
21 changes: 12 additions & 9 deletions Drink-EG/Drink-EG/Sources/VCs/AddNewNoteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class AddNewNoteViewController: UIViewController, UITableViewDataSource, UITable
return s
}()

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
Expand All @@ -64,7 +69,7 @@ class AddNewNoteViewController: UIViewController, UITableViewDataSource, UITable
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
Expand All @@ -77,26 +82,24 @@ class AddNewNoteViewController: UIViewController, UITableViewDataSource, UITable

func setupLabel() { // Label의 기본 속성을 설정하는 함수
tastingnoteLabel.text = "테이스팅 노트"
tastingnoteLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
tastingnoteLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
tastingnoteLabel.textAlignment = .center
tastingnoteLabel.textColor = .black
}

func setuptastingnoteLabelConstraints() { // Label의 제약 조건을 설정하는 함수
tastingnoteLabel.snp.makeConstraints{ make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(46)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(16)
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(20)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(27)
}
}

func setupWineSearchBarConstraints() {
wineSearchBar.snp.makeConstraints { make in
make.top.equalTo(tastingnoteLabel.snp.bottom).offset(46)
make.leading.equalTo(tastingnoteLabel.snp.leading)
make.centerX.equalTo(view.safeAreaLayoutGuide.snp.centerX)
make.height.equalTo(34)
make.top.equalTo(tastingnoteLabel.snp.bottom).offset(10)
make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16)
make.height.equalTo(UIConstants.searchBarHeight)
}

}

func setupSuggestionTableView() {
Expand Down
13 changes: 9 additions & 4 deletions Drink-EG/Drink-EG/Sources/VCs/ChooseTasteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class ChooseTasteViewController: UIViewController, UICollectionViewDelegate, UIC
var tasteCollectionView: UICollectionView!
var finishCollectionView: UICollectionView!

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
Expand Down Expand Up @@ -211,7 +216,7 @@ class ChooseTasteViewController: UIViewController, UICollectionViewDelegate, UIC
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
Expand Down Expand Up @@ -243,15 +248,15 @@ class ChooseTasteViewController: UIViewController, UICollectionViewDelegate, UIC
func setupLabel() { // Label의 기본 속성을 설정하는 함수
contentView.addSubview(tastingnoteLabel)
tastingnoteLabel.text = "테이스팅 노트"
tastingnoteLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
tastingnoteLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
tastingnoteLabel.textAlignment = .center
tastingnoteLabel.textColor = .black
}

func setuptastingnoteLabelConstraints() { // Label의 제약 조건을 설정하는 함수
tastingnoteLabel.snp.makeConstraints{ make in
make.top.equalTo(contentView.snp.top).offset(46)
make.leading.equalTo(contentView.snp.leading).offset(16)
make.top.equalTo(contentView.snp.top).offset(20)
make.leading.equalTo(contentView.snp.leading).offset(27)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class CommunityMainViewController : UIViewController, UITableViewDataSource, UIT
make.top.equalTo(communityLabel.snp.bottom).offset(46)
make.leading.equalTo(communityLabel.snp.leading)
make.centerX.equalTo(contentView.snp.centerX)
make.height.equalTo(34)
make.height.equalTo(UIConstants.searchBarHeight)
}
}

Expand Down
12 changes: 8 additions & 4 deletions Drink-EG/Drink-EG/Sources/VCs/NoteInfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class NoteInfoViewController: UIViewController {
var selectedWineArea: String?
var selectedWineSort: String?

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -70,7 +74,7 @@ class NoteInfoViewController: UIViewController {
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
Expand All @@ -85,15 +89,15 @@ class NoteInfoViewController: UIViewController {
func setupLabel() { // Label의 기본 속성을 설정하는 함수
contentView.addSubview(tastingnoteLabel)
tastingnoteLabel.text = "테이스팅 노트"
tastingnoteLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
tastingnoteLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
tastingnoteLabel.textAlignment = .center
tastingnoteLabel.textColor = .black
}

func setuptastingnoteLabelConstraints() { // Label의 제약 조건을 설정하는 함수
tastingnoteLabel.snp.makeConstraints{ make in
make.top.equalTo(contentView.safeAreaLayoutGuide.snp.top).offset(46)
make.leading.equalTo(contentView.safeAreaLayoutGuide.snp.leading).offset(16)
make.top.equalTo(contentView.safeAreaLayoutGuide.snp.top).offset(20)
make.leading.equalTo(contentView.safeAreaLayoutGuide.snp.leading).offset(27)
}
}

Expand Down
12 changes: 6 additions & 6 deletions Drink-EG/Drink-EG/Sources/VCs/NoteListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class NoteListViewController: UIViewController, UICollectionViewDelegate, UIColl

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
setupAPI()
}

Expand All @@ -87,8 +87,8 @@ class NoteListViewController: UIViewController, UICollectionViewDelegate, UIColl
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
let backArrow = UIImage(systemName: "chevron.backward")
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
leftButton.tintColor = .black
Expand All @@ -101,15 +101,15 @@ class NoteListViewController: UIViewController, UICollectionViewDelegate, UIColl
// MARK: 노트 보관함에 관한 UI
func setupLabel() { // Label의 기본 속성을 설정하는 함수
noteListLabel.text = "노트 보관함"
noteListLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
noteListLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
noteListLabel.textAlignment = .center
noteListLabel.textColor = .black
}

func setupNoteListLabelConstraints() { // Label의 제약 조건을 설정하는 함수
noteListLabel.snp.makeConstraints{ make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(46)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(16)
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(20)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(27)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ class CheckNoteViewController: UIViewController {
}
}

private let wineInfoLabel: UILabel = {
let w = UILabel()
w.text = "와인 정보"
w.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
w.textAlignment = .center
w.textColor = .black
return w
}()

private let infoView: UIView = {
let v = UIView()
v.backgroundColor = UIColor(hex: "FBCBC4")
Expand Down Expand Up @@ -243,24 +252,50 @@ class CheckNoteViewController: UIViewController {
finishButton.layer.cornerRadius = 10
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
print(selectedOptions)
setupNavigationBarButton()
setupView()
setupUI()
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
leftButton.tintColor = .black
}

@objc func backButtonTapped() {
navigationController?.popViewController(animated: true)
}

private func setupUI() {
setupPentagonChart()
setupButton()
setupReview()

contentView.addSubview(wineInfoLabel)

wineInfoLabel.snp.makeConstraints { make in
make.top.equalTo(contentView.safeAreaLayoutGuide).offset(20)
make.leading.equalTo(contentView.safeAreaLayoutGuide).offset(27)
}

contentView.addSubview(infoView)

infoView.snp.makeConstraints { make in
make.top.equalTo(contentView.safeAreaLayoutGuide).offset(50)
make.leading.trailing.equalTo(contentView.safeAreaLayoutGuide).inset(14)
make.top.equalTo(wineInfoLabel.snp.bottom).offset(30)
make.leading.equalTo(wineInfoLabel.snp.leading)
make.centerX.equalTo(contentView.snp.centerX)
make.height.equalTo(UIScreen.main.bounds.height * 0.09)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class RatingViewController: UIViewController {

let provider = MoyaProvider<TastingNoteAPI>(plugins: [CookiePlugin()])

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
Expand Down Expand Up @@ -71,7 +76,7 @@ class RatingViewController: UIViewController {
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
Expand Down Expand Up @@ -101,15 +106,15 @@ class RatingViewController: UIViewController {
func setupLabel() { // Label의 기본 속성을 설정하는 함수
contentView.addSubview(tastingnoteLabel)
tastingnoteLabel.text = "테이스팅 노트"
tastingnoteLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
tastingnoteLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
tastingnoteLabel.textAlignment = .center
tastingnoteLabel.textColor = .black
}

func setuptastingnoteLabelConstraints() { // Label의 제약 조건을 설정하는 함수
tastingnoteLabel.snp.makeConstraints{ make in
make.top.equalTo(contentView.snp.top).offset(46)
make.leading.equalTo(contentView.snp.leading).offset(16)
make.top.equalTo(contentView.snp.top).offset(20)
make.leading.equalTo(contentView.snp.leading).offset(27)
}
}

Expand Down
13 changes: 9 additions & 4 deletions Drink-EG/Drink-EG/Sources/VCs/WriteNoteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class WriteNoteViewController: UIViewController {
let contentView = UIView()
let nextButton = UIButton()

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
Expand Down Expand Up @@ -63,7 +68,7 @@ class WriteNoteViewController: UIViewController {
}

func setupNavigationBarButton() {
navigationItem.hidesBackButton = true
navigationItem.hidesBackButton = false
let backArrow = UIImage(systemName: "chevron.backward")
let leftButton = UIBarButtonItem(image: backArrow, style: .plain, target: self, action: #selector(backButtonTapped))
navigationItem.leftBarButtonItem = leftButton
Expand All @@ -77,15 +82,15 @@ class WriteNoteViewController: UIViewController {
func setupLabel() { // Label의 기본 속성을 설정하는 함수
contentView.addSubview(tastingnoteLabel)
tastingnoteLabel.text = "테이스팅 노트"
tastingnoteLabel.font = UIFont(name: "Pretendard-Bold", size: 28)
tastingnoteLabel.font = .systemFont(ofSize: UIConstants.labelFontSize, weight: UIFont.Weight(rawValue: 700))
tastingnoteLabel.textAlignment = .center
tastingnoteLabel.textColor = .black
}

func setuptastingnoteLabelConstraints() { // Label의 제약 조건을 설정하는 함수
tastingnoteLabel.snp.makeConstraints{ make in
make.top.equalTo(contentView.safeAreaLayoutGuide.snp.top).offset(46)
make.leading.equalTo(contentView.safeAreaLayoutGuide.snp.leading).offset(16)
make.top.equalTo(contentView.safeAreaLayoutGuide.snp.top).offset(20)
make.leading.equalTo(contentView.safeAreaLayoutGuide.snp.leading).offset(27)
}
}

Expand Down

0 comments on commit f2ef874

Please sign in to comment.