Skip to content

Commit 3298114

Browse files
committed
Fix: WithdrawViewController SE 기기 대응
1 parent a5cc391 commit 3298114

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

Projects/Presentation/Sources/Withdraw/View/WithdrawViewController.swift

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ final class WithdrawViewController: BaseViewController<WithdrawViewModel> {
1414
private enum Layout {
1515
static let horizontalMargin: CGFloat = 20
1616
static let mainLabelTopSpacing: CGFloat = 86
17+
static let mainLabelTopMinSpacing: CGFloat = 66
1718
static let subLabelTopSpacing: CGFloat = 5
1819
static let confirmStackViewTopSpacing: CGFloat = 24
1920
static let confirmButtonSize: CGFloat = 24
2021
static let withdrawReasonViewTopSpacing: CGFloat = 62
22+
static let withdrawReasonViewTopMinSpacing: CGFloat = 25
2123
static let withdrawReasonTextViewPlaceholderTopSpacing: CGFloat = 13
2224
static let withdrawReasonTextViewHorizontalMargin: CGFloat = 16
2325
static let withdrawReasonTextViewVerticalMargin: CGFloat = 13
@@ -44,8 +46,28 @@ final class WithdrawViewController: BaseViewController<WithdrawViewModel> {
4446
private let withdrawReasonMaxLength: Int = 100
4547
private let withdrawButton = PrimaryButton(buttonState: .disabled, buttonTitle: "탈퇴하기")
4648

49+
private var isLayoutConfigured: Bool = false
50+
private var mainLabelTopConstraint: Constraint?
51+
private var withdrawReasonViewTopConstraint: Constraint?
4752
private var cancellables: Set<AnyCancellable> = []
4853

54+
override func viewDidLayoutSubviews() {
55+
super.viewDidLayoutSubviews()
56+
57+
if !isLayoutConfigured {
58+
updateConstraint()
59+
isLayoutConfigured = true
60+
}
61+
}
62+
63+
private func updateConstraint() {
64+
let height = view.bounds.height
65+
if height <= 667 {
66+
mainLabelTopConstraint?.update(offset: Layout.mainLabelTopMinSpacing)
67+
withdrawReasonViewTopConstraint?.update(offset: Layout.withdrawReasonViewTopMinSpacing)
68+
}
69+
}
70+
4971
override func configureAttribute() {
5072
view.backgroundColor = .systemBackground
5173
navigationController?.setNavigationBarHidden(true, animated: false)
@@ -139,7 +161,7 @@ final class WithdrawViewController: BaseViewController<WithdrawViewModel> {
139161
view.addSubview(withdrawButton)
140162

141163
mainLabel.snp.makeConstraints { make in
142-
make.top.equalTo(safeArea).offset(Layout.mainLabelTopSpacing)
164+
mainLabelTopConstraint = make.top.equalTo(safeArea).offset(Layout.mainLabelTopSpacing).constraint
143165
make.horizontalEdges.equalTo(safeArea).inset(Layout.horizontalMargin)
144166
}
145167

@@ -158,7 +180,7 @@ final class WithdrawViewController: BaseViewController<WithdrawViewModel> {
158180
}
159181

160182
withdrawReasonView.snp.makeConstraints { make in
161-
make.top.equalTo(confirmStackView.snp.bottom).offset(Layout.withdrawReasonViewTopSpacing)
183+
withdrawReasonViewTopConstraint = make.top.equalTo(confirmStackView.snp.bottom).offset(Layout.withdrawReasonViewTopSpacing).constraint
162184
make.horizontalEdges.equalTo(safeArea)
163185
make.bottom.equalTo(withdrawButton.snp.top)
164186
}

0 commit comments

Comments
 (0)