TextField in Table

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

  1. henkhenk macrumors newbie

    Joined:
    Nov 2, 2009
    #1
    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
      1.jpg
      File size:
      45.3 KB
      Views:
      53
  2. csnplt macrumors 6502

    csnplt

    Joined:
    Aug 29, 2008
    Location:
    Chicago Area
    #2
    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

    Joined:
    Nov 2, 2009
  4. henkhenk thread starter macrumors newbie

    Joined:
    Nov 2, 2009
    #4
    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];

    tanks
     
  5. henkhenk thread starter macrumors newbie

    Joined:
    Nov 2, 2009
    #5
    if you check out the sample codes on the following link

    http://code.google.com/p/cookbooksamples/downloads/list

    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