El teclado Swift 3 NSNotificationCenter se mostrará / ocultará
Tengo un código que funcionó en Swift 2 e intenté usar xCode para actualizar el código a la versión más reciente y arreglé todo excepto dos problemas
Tengo este codigo
let loginvc : LoginVC = self.storyboard?.instantiateViewController(withIdentifier: "LoginVC") as! LoginVC
NotificationCenter.defaultCenter().addObserver(self, selector: #selector(LoginViewController.keyboardWillShow(_:)), name: UIKeyboardWillShowNotification, object: nil)
NotificationCenter.defaultCenter().addObserver(self, selector: #selector(LoginViewController.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)
que se combina con esto
func keyboardWillShow(notification: NSNotification) {
constraint.constant = -100
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded()
}
}
func keyboardWillHide(notification: NSNotification) {
constraint.constant = 25
UIView.animate(withDuration: 0.3) {
self.view.layoutIfNeeded()
}
}
En la primera parte, ahora aparece un error que dice "Escriba 'LoginViewController' no tiene miembro 'keyboardwillshow / hide'
No entiendo por qué no se ve el método debajo
¿Alguien sabe una solución a este problema?