IQKeyboardManager 这样处理 UITextView 的键盘事件,
键盘出现,走方法
func adjustPosition() {
UITextView 继承自 UIScrollView,
UITextView 通过判断,过滤掉 UITextField,
if let textView = textFieldView as? UIScrollView, textFieldView.responds(to: #selector(getter: UITextView.isEditable)) {
键盘出现调
textView.contentInset
UIView.animate(withDuration: _animationDuration, delay: 0, options: _animationCurve.union(.beginFromCurrentState), animations: { () -> Void in
textView.contentInset = newContentInset
textView.scrollIndicatorInsets = newContentInset
})
实现这么个需求,
上面有一个输入条,TextField,
中间是一个输入框,TextView
-
键盘出现,按钮浮现在键盘之上,
-
键盘消失,按钮恢复在底部