From e2afd474f3d7ada7f1a1a5876fef66121a5929e4 Mon Sep 17 00:00:00 2001 From: otoolz Date: Sat, 13 Jan 2024 05:20:09 +0900 Subject: [PATCH] =?UTF-8?q?feat=20#394:=20=EC=97=AC=ED=96=89=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=A0=9C=EB=AA=A9=20=EA=B8=80=EC=9E=90=EC=88=98=20?= =?UTF-8?q?=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TravelFeature/TravelScene/VC/TravelVC.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift index 7a87e20..9a6d580 100644 --- a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift +++ b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift @@ -20,6 +20,8 @@ final class TravelVC: UIViewController { } private enum Constants { + static let titleLimit: Int = 14 + static let titleLimitToastMessage = "제목은 1 - 14자 이내만 가능합니다." static let title: String = "여행 생성" static let textFieldPlaceholder: String = "제목 *" static let done: String = "완료" @@ -144,6 +146,7 @@ final class TravelVC: UIViewController { private extension TravelVC { func setupAttributes() { + view.keyboardLayoutGuide.followsUndockedKeyboard = true view.backgroundColor = TLColor.black titleTextField.placeholder = Constants.textFieldPlaceholder baseScrollView.delegate = self @@ -354,6 +357,14 @@ extension TravelVC: UITextFieldDelegate { dismissKeyboard() return true } + + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + let text = textField.text ?? "" + if text.count + string.count > Constants.titleLimit { + return false + } + return true + } } // MARK: - TLBottomSheetDelegate