Skip to content

Commit be0ac20

Browse files
committedMay 19, 2023
[FEAT] keyboard return key 처리
1 parent b2a0640 commit be0ac20

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
 

‎View/Generate3DView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Generate3DView {
8989
tf_search.textColor = .textGray
9090
tf_search.font = .suit(size: 14, weight: .w500)
9191
tf_search.addSubview(btn_search)
92-
tf_search.returnKeyType = .done
92+
tf_search.returnKeyType = .search
9393
btn_search.becomeFirstResponder()
9494

9595
btn_search.snp.makeConstraints { make in

‎ViewController/Generate3D/Generate3DTabController.swift

+15-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import UIKit
99
import RxCocoa
10+
import Toast_Swift
1011

1112
class Generate3DTabController: UIViewController {
1213
let generate3DView = Generate3DView()
@@ -39,7 +40,7 @@ class Generate3DTabController: UIViewController {
3940
// MARK: - Event Delegate
4041
extension Generate3DTabController: UITextFieldDelegate {
4142
@objc func didTapSearchBtn(_ sender: UIButton) {
42-
print("search")
43+
self.searchAndPresent()
4344
}
4445

4546
@objc func didTapCameraBtn(_ sender: UIButton) {
@@ -54,4 +55,17 @@ extension Generate3DTabController: UITextFieldDelegate {
5455
textField.resignFirstResponder()
5556
return true
5657
}
58+
59+
func textFieldDidEndEditing(_ textField: UITextField) {
60+
self.searchAndPresent()
61+
}
62+
63+
private func searchAndPresent() {
64+
guard self.generate3DView.tf_search.hasText, let keyword = self.generate3DView.tf_search.text else {
65+
self.view.makeToast("키워드를 입력해주세요", duration: 2, position: .center)
66+
return
67+
}
68+
69+
self.navigationController?.pushViewController(EditTextViewController(key: keyword), animated: true)
70+
}
5771
}

0 commit comments

Comments
 (0)
Please sign in to comment.