resignFirstResponder not hiding keyboard on textFieldShouldReturn

后端 未结 14 1709
我在风中等你
我在风中等你 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:28

    To deal with the bug mentioned by Brandon, you can try closing and re-opening your modal view controller as long as you still have a reference to it.

    [textField resignFirstResponder];
    [self dismissModalViewControllerAnimated:NO];
    [self presentModalViewController:yourModalViewControllerReference animated:NO];
    

    (where "self" should be the controller you used to originally open the modal view controller)

提交回复
热议问题