I have 2 textfields.I am checking when the both textfields are filled, than, i change the keyboard return button to “Go”.Else, it will remain as “Return”.
Its working fine, the keyboard’s return type changes,only, when i tap on textfield.
I want, to change it automatically, once both the textfields are non-empty.
I tried putting my code
if ([txtEmail.text length] > 0 && [txtPass.text length] > 0) {
// Set the return key here, e.g:
txtEmail.returnKeyType = UIReturnKeyGo;
txtPass.returnKeyType = UIReturnKeyGo;
}
else {
// Set the return key here, e.g:
txtEmail.returnKeyType = UIReturnKeyDefault;
txtPass.returnKeyType = UIReturnKeyDefault;
}
at
- (void)textFieldDidBeginEditing:(UITextField *)textField{}
but its not working for me.
Any idea, how can i change the return button from return to Go, when both he fields are non empty,automatically, user don’t have tap on any text field to change it.
Set delegate for both textfields.then put your code in viewDidLoad once after creating reference of UItextFields