imzyf / ios-swift-learning-notes

📝 iOS Swift Learning Notes - see Issues
MIT License
0 stars 0 forks source link

textField 有焦点 无弹键盘 #113

Open imzyf opened 5 years ago

imzyf commented 5 years ago
textField?.inputView = UIView()
textField?.reloadInputViews() // 12 下 没有这个无法切回来
textField?.becomeFirstResponder()

恢复

        textField?.inputView = nil
        textField?.reloadInputViews()
        textField?.becomeFirstResponder()

inputView 可以自定义 就相当于一个 自定义的键盘

textField?.inputAccessoryView 键盘上的 工具条

imzyf commented 5 years ago

https://medium.com/@KaushElsewhere/how-to-dismiss-keyboard-in-a-view-controller-of-ios-3b1bfe973ad1

Best way to dismiss Keyboard in a View Controller iOS (Swift)