The following code is the solution code analysis of the swift3.0 keyboard pop-up occlusion input box problem introduced to you by the editor. The specific code is as follows;
extension LoginViewController:UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { () //Retract the keyboard and put the view down(withDuration: 0.4, animations: { = 0 }) return true } func textFieldDidBeginEditing(_ textView:UITextField) { // View pops up and follows the keyboard, high can be defined according to your own(withDuration: 0.4, animations: { = -150 }) } }
OK, the code ends here, I hope it will be helpful to everyone!