Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging returnButton while editing freezes keyboard for 1 tap
    text
    copied!<p>I'm making a login screen for my app and i want the return button to say "Next" when there is a field that is not yet filled out and it sould say "Go" when all fields are filled (i'm talking about UITextFields).</p> <p>The code below works fine in that it shows Next and Go at the correct moments. But whenever it changes from "Next" to "Go" the next tap on the keyboard is ignored. When it says "Go" and i empty the textfield by backspacing there is no such problem and it shows Next as it should. It's almost like the old keyboard is still there and vanishes after being tapped.</p> <p>My question is: what is the source of this problem and more importantly how do i get rid of this freezing up of the keyboard?</p> <pre><code>UITextField *theSender = (UITextField *)sender; if (allTextFieldsAreFilled) { if (theSender.returnKeyType!=UIReturnKeyGo) { theSender.returnKeyType = UIReturnKeyGo; [theSender resignFirstResponder]; [theSender becomeFirstResponder]; } } else { if (theSender.returnKeyType!=UIReturnKeyNext) { theSender.returnKeyType = UIReturnKeyNext; [theSender resignFirstResponder]; [theSender becomeFirstResponder]; } } </code></pre> <p>This code gets called every time the value of one of the three UITextFields is changed, so it is an IBAction connected to the Editing Changed event.</p> <p>Thanks in advance for your help!</p> <p><strong>EDIT</strong></p> <p>I found out this will only occur if the textfield is set to secure (password). When it is not set to secure it will not freeze up and my code works perfectly! The problem is that the change to the "Go" button will generally occur when a 'secure' textfield is fist responder. So this doesn't change anything to the problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload