From adc2db9bb29e7f316c46b6de679db1522ffc9cc8 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期五, 23 八月 2024 11:39:37 +0800 Subject: [PATCH] fix --- Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Toolbar.swift | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Toolbar.swift b/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Toolbar.swift index a7b1791..c6a31a0 100644 --- a/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Toolbar.swift +++ b/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager/IQKeyboardManager+Toolbar.swift @@ -176,7 +176,7 @@ } // Setting toolbar to keyboard. - if let textFieldView: UITextInput = textField as? UITextInput { + if let textFieldView: any UITextInput = textField as? (any UITextInput) { // Bar style according to keyboard appearance switch textFieldView.keyboardAppearance { @@ -230,12 +230,7 @@ /** Remove any toolbar if it is IQToolbar. */ internal func removeToolbarIfRequired() { // (Bug ID: #18) - guard let siblings: [UIView] = responderViews(), !siblings.isEmpty, - let textField: UIView = activeConfiguration.textFieldViewInfo?.textFieldView, - textField.responds(to: #selector(setter: UITextField.inputAccessoryView)), - textField.inputAccessoryView == nil || - textField.inputAccessoryView?.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag || - textField.inputAccessoryView?.tag == IQKeyboardManager.kIQDoneButtonToolbarTag else { + guard let siblings: [UIView] = responderViews(), !siblings.isEmpty else { return } @@ -245,28 +240,31 @@ showLog("Found \(siblings.count) responder sibling(s)") for view in siblings { - if let toolbar: IQToolbar = view.inputAccessoryView as? IQToolbar { - - // setInputAccessoryView: check (Bug ID: #307) - if view.responds(to: #selector(setter: UITextField.inputAccessoryView)), - toolbar.tag == IQKeyboardManager.kIQDoneButtonToolbarTag || - toolbar.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag { - - if let textField: UITextField = view as? UITextField { - textField.inputAccessoryView = nil - } else if let textView: UITextView = view as? UITextView { - textView.inputAccessoryView = nil - } - - view.reloadInputViews() - } - } + removeToolbarIfRequired(of: view) } let elapsedTime: CFTimeInterval = CACurrentMediaTime() - startTime showLog("<<<<< \(#function) ended: \(elapsedTime) seconds <<<<<", indentation: -1) } + /** Remove any toolbar if it is IQToolbar. */ + internal func removeToolbarIfRequired(of view: UIView) { // (Bug ID: #18) + + guard view.responds(to: #selector(setter: UITextField.inputAccessoryView)), + let toolbar: IQToolbar = view.inputAccessoryView as? IQToolbar, + toolbar.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag || + toolbar.tag == IQKeyboardManager.kIQDoneButtonToolbarTag else { + return + } + + // setInputAccessoryView: check (Bug ID: #307) + if let textField: UITextField = view as? UITextField { + textField.inputAccessoryView = nil + } else if let textView: UITextView = view as? UITextView { + textView.inputAccessoryView = nil + } + } + /** reloadInputViews to reload toolbar buttons enable/disable state on the fly Enhancement ID #434. */ @objc func reloadInputViews() { -- Gitblit v1.7.1