我用Swift 4.2得到了这个错误
类型'NSNotification.Name'没有成员'keyboardDidShowNotification'
这是我的代码:
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.keyboardDidShowNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)
下面一个用Swift 4工作正常,但没有用Swift 4.2
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(notification:)), name: NSNotification.Name.UIKeyboardDidShow, object: nil)
Run Code Online (Sandbox Code Playgroud)