PDA

View Full Version : Return Key Functionality




ilx.mac
Aug 7, 2009, 02:47 AM
Hi There,

I have 7 textfields placed in a uitableview. I have the return key type of keyboard as default.

When the user selects the first textfield and enter some data & press return key of the keyboard, the focus has to move to next textfield which is placed in the next row.

I googled a lot & i could not find a proper solution for this.

Can you guys help me on this?


Thanks in Advance!:)



mccannmarc
Aug 7, 2009, 06:43 AM
You will need to make your class a UITextField delegate and then implement the

- (BOOL)textFieldShouldReturn:(UITextField *)textField

callback. Within the callback you can set the next textfield to be the first responder or whatever. It will be much easier to manage if you have your 7 textfields as an array as you can just increment the index of the array then to set the next one as first responder. When you reach the end of the textfields you can either just loop it around or make the submit button or whatever the first responder.