TextField in Table

Discussion in 'iPhone' started by henkhenk, Dec 12, 2009.

  1. henkhenk macrumors newbie

    Nov 2, 2009
    hi guys

    I have text filed in table. it works fine so far. but my question is when I touch inside the text field, the keyboard is overlapping with it as shown on my attached picture.

    how I make the table to move a bit up when the keyboard come knowing that the text field will be covered?

    I have checked out different sample codes including UICatalog it works there and its not working for me :( and I couldn't find any difference b/n there code and mind

    Attached Files:

    • 1.jpg
      File size:
      45.3 KB
  2. csnplt macrumors 6502


    Aug 29, 2008
    Chicago Area
    Try using -scrollToRowAtIndexPath:atScrollPosition:animated:

    You can read more in the documentation, but basically, it will scroll to that row . If you set the scroll position to top (can't remember what the exact constant is called, but again, it's in the documentation), it will set that row at the top of the tableview, so a user will be able to edit the textfield easily. Once you're done editing (use text field delegate), you'll be able to use the same method to scroll back to the original row that was at the top.

    An easier solution would be to just put the text field at a higher row on the table view, so no scrolling is needed.
  3. henkhenk thread starter macrumors newbie

    Nov 2, 2009
  4. henkhenk thread starter macrumors newbie

    Nov 2, 2009
    scroll table view

    [tblview scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

    works, but it wont exactely scroll were I want to to go.

    can I replace UITableViewScrollPositionTop by a number? like:
    [tblview scrollToRowAtIndexPath:indexPath atScrollPosition:300 animated:YES];

  5. henkhenk thread starter macrumors newbie

    Nov 2, 2009
    if you check out the sample codes on the following link


    the last sample code from C06 - Tables2.zip illustrates text field in a table.

    and the view scrolls properly when the key board show up. I couldn't relay find which part of the code make this to happen :(

Share This Page