我在使用Swift 4.2时遇到了这个错误:
Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'
这是我的代码:
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.keyboardDidShowNotification, object: nil)
以下代码在Swift 4中工作正常,但在Swift 4.2中不起作用。
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.UIKeyboardDidShow, object: nil)