很长一段时间以来,我一直在寻找一个利用UIKeyboardWillChangeFrameNotification
的Swift实现到目前为止我还没有遇到任何问题。我正在努力使其工作,以便我可以处理键盘显示并隐藏在文档here中所述的一种方法中,以及用objective-c编写的here。
并替换这些:
// Register your Notification, To know When Keyboard appears.
NotificationCenter.default.addObserver(self, selector: #selector(myKeyboardWillShowMethod), name: .UIKeyboardWillShow, object: nil)
// Register your Notification, To know When Keyboard hides.
NotificationCenter.default.addObserver(self, selector: #selector(myKeyboardWillHideMethod), name: .UIKeyboardWillHide, object: nil)