resignFirstResponder not hiding keyboard on textFieldShouldReturn

后端 未结 14 1730
我在风中等你
我在风中等你 2020-12-05 10:11

I have a view with a UITextField which should hide the keyboard when return is pressed.

My function is this:

- (BOOL)textFieldShouldReturn:(UITextFie         


        
14条回答
  •  星月不相逢
    2020-12-05 10:31

    Based on your comment that it looks like focus has shifted, then I think what may be happening is that the keyboard is staying open for the next text input field. If your return key is a "Next" key, then returning YES for textFieldShouldReturn: will make the next textField the first responder, and keep the keyboard visible.

提交回复
热议问题