From ad1313407b71dbfdc3fa8a551f1dadc590e48522 Mon Sep 17 00:00:00 2001 From: hwangJi-dev Date: Thu, 14 Jul 2022 22:39:27 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=C2=A0Chore:=20#404=20-=20NadoSunbaeNa?= =?UTF-8?q?viBar=EC=97=90=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=202?= =?UTF-8?q?=EC=A4=84=20NaviBar=20Style=EC=9D=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponent/Class/NadoSunbaeNaviBar.swift | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/NadoSunbae-iOS/NadoSunbae-iOS/Global/UIComponent/Class/NadoSunbaeNaviBar.swift b/NadoSunbae-iOS/NadoSunbae-iOS/Global/UIComponent/Class/NadoSunbaeNaviBar.swift index f4dccac1..e5bfdd3f 100644 --- a/NadoSunbae-iOS/NadoSunbae-iOS/Global/UIComponent/Class/NadoSunbaeNaviBar.swift +++ b/NadoSunbae-iOS/NadoSunbae-iOS/Global/UIComponent/Class/NadoSunbaeNaviBar.swift @@ -14,6 +14,7 @@ enum NaviState { case backDefaultWithNadoBtn case backDefaultWithCustomRightBtn case backWithCenterTitle + case backWithTwoLineTitle case dismissWithCustomRightBtn case dismissWithNadoBtn } @@ -24,6 +25,7 @@ enum NaviState { - backDefault: 뒤로가기 버튼 + 바로 옆 텍스트 (디폴트) - backDefaultWithNadoBtn: 뒤로가기 버튼과 + 바로 옆 텍스트 + 우측 나도선배 버튼 - backWithCenterTitle: 뒤로가기 버튼 + 중앙 텍스트 + 우측 버튼 + - backWithTwoLineTitle: 뒤로가기 버튼 + 중앙 2줄 텍스트 + 우측 버튼 - dismissWithCustomRightBtn: 취소 버튼과 중앙 텍스트 + 우측 버튼 - dismissWithNadoBtn: 취소 버튼과 중앙 텍스트 + 우측 나도선배 버튼 @@ -42,6 +44,10 @@ class NadoSunbaeNaviBar: UIView { $0.setLabel(text: "제목", color: .black, size: 20, weight: .medium) } + private (set) lazy var subTitleLabel = UILabel().then { + $0.setLabel(text: "제목", color: .gray3, size: 12, weight: .regular) + } + private (set) lazy var backBtn = UIButton().then { $0.setImgByName(name: "btnBack", selectedName: nil) $0.contentMode = .scaleAspectFit @@ -174,6 +180,39 @@ extension NadoSunbaeNaviBar { titleLabel.setLabel(text: "제목", color: .black, size: 16, weight: .medium) } + /// 뒤로가기 버튼 + 중앙 2줄 텍스트 + 우측 커스텀 버튼 UI를 구성하는 메서드 + private func configureBackWithTwoLineTitleUI() { + self.addSubviews([backView, backBtn, titleLabel, subTitleLabel, rightCustomBtn]) + backView.snp.makeConstraints { + $0.top.leading.trailing.bottom.equalToSuperview() + } + + backBtn.snp.makeConstraints { + $0.bottom.equalToSuperview().offset(-12) + $0.leading.equalToSuperview() + $0.height.width.equalTo(48) + } + + titleLabel.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.centerY.equalTo(backBtn) + } + + subTitleLabel.snp.makeConstraints { + $0.top.equalTo(titleLabel.snp.bottom) + $0.centerX.equalToSuperview() + } + + rightCustomBtn.snp.makeConstraints { + $0.trailing.equalTo(self.snp.trailing).offset(-8) + $0.height.equalTo(44) + $0.centerY.equalTo(backBtn) + } + + titleLabel.setLabel(text: "제목", color: .black, size: 16, weight: .medium) + subTitleLabel.setLabel(text: "제목", color: .gray3, size: 12, weight: .regular) + } + /// 취소 버튼 + 중앙 텍스트 + 우측 커스텀 버튼 UI를 구성하는 메서드 private func configureDismissWithCustomRightBtnUI() { self.addSubviews([backView, dismissBtn, titleLabel, rightCustomBtn]) @@ -252,6 +291,8 @@ extension NadoSunbaeNaviBar { configureBackWithNadoBtnUI() case .backWithCenterTitle: configureBackWithCenterUI() + case .backWithTwoLineTitle: + configureBackWithTwoLineTitleUI() case .backDefaultWithCustomRightBtn: configureBackWithCustomRightBtn() case .dismissWithCustomRightBtn: