I have been trying to figure out how to get the next button on the UIKeyboard to load the next UITextField.. I have two cells, Name and Email I would like to go from Name to Email using the Next button.
so far I have added
//.h
<UITextFieldDelegate>
then I am doing this to try and pass the user from Name to Email
//.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
customerNameTextField.delegate = self;
customerEmailTextField.delegate = self;
//...
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (![customerNameTextField.text isEqualToString:@""]) {
[customerNameTextField resignFirstResponder];
[customerEmailTextField becomeFirstResponder];
} else if (textField == customerEmailTextField) {
// here you can define what happens
// when user presses return on the email field
// send request
}
return YES;
}
It enters the first if statment, then It removes the keyboard from the screen using resignFirstResponder but then it dose not load the new keyboard using becomeFirstResponder.. Any help fixing this would be greatly apprecaited.
This will go from one textfield to next textField...
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (textField == ist) {
[second becomeFirstResponder];
}
else if (textField == second) {
[third becomeFirstResponder];
}
else{
[textField resignFirstResponder];
}
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With