0

There is a UIScrollView, contentView of scrollView have a UINibView, UINibView have three UITextField:

Action of first UITextField: display a custom view; Action of second UITextField: show system keyboard; Action of third UITextField: display a custom view.

Click the second one first, then click the first, the keyboard cannot be hidden at this time.

kehuiInfoView.dateInput.rx.controlEvent(.editingDidBegin)
            .subscribe { _ in
                weakSelf?.view.endEditing(true)
                weakSelf?.kehuiInfoView.dateInput.resignFirstResponder()
                weakSelf?.datePicker.show()
            }
            .disposed(by: bag)
  • If you show your custom views by adding them to the text fields' inputViews then everything will be far easier to deal with. – Daniel T. Sep 09 '21 at 11:33
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 15 '21 at 04:56

1 Answers1

0

If your text field is supposed to use a date picker for its input, you can consider using this: https://github.com/danielt1263/CLE-Architecture-Tools/blob/main/Tools/UITextField%2BWheeledDatePicker.swift

With the above, you could for example call:

let date = textField.wheeledDatePicker(initial: Date(), formatter: dateFormatter) { $0.datePickerMode = .date }

Which will handle bringing up and dismissing the date picker for you.

Daniel T.
  • 32,821
  • 6
  • 50
  • 72