这是我添加观察者的功能
func subscribeToKeyboardNotifications() {
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: .UIKeyboardWillShow, object: nil)
}
但.UIKeyboardWillShow
给了我一个错误
'UIKeyboardWillShow' 已重命名为 'UIResponder.keyboardWillShowNotification'
将“UIKeyboardWillShow”替换为“UIResponder.keyboardWillShowNotification”
但是当我更换它时
func subscribeToKeyboardNotifications() {
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: .UIResponder.keyboardWillShowNotification, object: nil)
}
我收到这个错误
在没有更多上下文的情况下,表达式的类型是模棱两可的