Return Key Functionality

Discussion in 'iOS Programming' started by ilx.mac, Aug 7, 2009.

  1. ilx.mac macrumors member

    Mar 10, 2009
    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!:)
  2. mccannmarc macrumors 6502


    Aug 15, 2008
    Manchester, UK
    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.

Share This Page