Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to use "Next" version of Return button on UITextField to move to next UITextField

Tags:

iphone

I use the "Next" value for the "Return Key" to get the Next button in place of the Done button, but (obviously) pressing it doesn't automatically move to the next UITextField in my view.

What's the right way to do this? On a larger topic, what are some tips for properly building forms in the iPhone SDK?

like image 681
3n. Avatar asked Jun 14 '09 05:06

3n.


People also ask

What is resignFirstResponder Swift?

resignFirstResponder()Notifies this object that it has been asked to relinquish its status as first responder in its window.


1 Answers

Make some object the first text field's delegate, and implement the - (BOOL)textFieldShouldReturn:(UITextField *)textField method; in that, call the second text field's -becomeFirstResponder. Returning YES from that will make the text field perform its default behavior for the return button – I think that's generally sending its action message. If you don't have anything added as a target of that action, it doesn't really matter what you return.

like image 66
Noah Witherspoon Avatar answered Sep 26 '22 13:09

Noah Witherspoon