Skip to content

Instantly share code, notes, and snippets.

@mikina
Created November 19, 2013 20:28
Show Gist options
  • Save mikina/7551978 to your computer and use it in GitHub Desktop.
Save mikina/7551978 to your computer and use it in GitHub Desktop.
Next field in form by tag property.
-(BOOL)textFieldShouldReturn:(UITextField*)textField;
{
NSInteger nextTag = textField.tag + 1;
// Try to find next responder
UIResponder* nextResponder = [textField.superview viewWithTag:nextTag];
if (nextResponder) {
// Found next responder, so set it.
[nextResponder becomeFirstResponder];
} else {
// Not found, so remove keyboard.
[textField resignFirstResponder];
}
return NO; // We do not want UITextField to insert line-breaks.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment