如何删除键盘通知?
我把键盘上的观察者打开和关闭。
我根据键盘打开或关闭来更改 View 大小。
最佳答案
试试这个来删除键盘打开显示观察者,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
您应该根据您的要求在 deinit
或 viewDidDisappear
中删除观察者。
关于ios - 移除 ViewController 消失时的键盘通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55395298/