Created
November 19, 2013 20:28
-
-
Save mikina/7551978 to your computer and use it in GitHub Desktop.
Next field in form by tag property.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(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