Type 'NSNotification.Name' has no member 'keyboardDidShowNotification'

前端 未结 4 2024
傲寒
傲寒 2020-12-05 13:42

I\'m getting this error with Swift 4.2

Type \'NSNotification.Name\' has no member \'keyboardDidShowNotification\'

Here is my cod

4条回答
  •  悲哀的现实
    2020-12-05 14:37

    I have used just the UIResponder.keyboardWillHideNotification except using NSNotification.Name. . This is working in SWIFT 5

    NotificationCenter.default.addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillShowNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
    
    NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHideNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
    

提交回复
热议问题