diff --git a/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift b/iOS/traveline/Sources/Feature/TravelFeature/TravelScene/VC/TravelVC.swift index 7a87e20a..9a6d580f 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