Keyboard is hiding UITextField

Discussion in 'iOS Programming' started by mcnuggets, Jan 16, 2009.

  1. macrumors newbie

    Joined:
    Jan 2, 2009
    #1
    If I place a text field and click on it... sometimes the keyboard that appears hides the textfield if the UITextField is a little bit on the bottom. Is there a way to fix this?
     
  2. macrumors 65816

    Joined:
    Jun 29, 2007
    #2
    Scroll the view up so it's visible or make sure the textfield is also high enough to not get hidden.
     
  3. thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #3
    Well moving the textfield higher would be a simple fix. But what if your entire view is filled with textfields (like 8 fields). So basically if I click on the last field... i want the view to automatically scroll up so that my keyboard will not hide the textview.
     
  4. macrumors 65816

    Joined:
    Jun 29, 2007
    #4
    Yeah, add all the textfields to a UIScrollView and if the textfield is far enough down when the user selects it scroll the view up so it's visible and back down they they're done.
     
  5. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  6. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
  7. thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #7
    I created a test app and made the view into a UIScrollView. In that view I added one UIViewText all the way at the bottom to see if I can scroll up. It's still not working. When I click on the Text field... the keyboard is hidding the field. Do i have to hold a keyboard key when I'm scrolling (ex: like the pinch feature on Iphone simulator)?

    By the way thanks for answering my questions. If it's not to much to ask, can you create a test app and attach the code?
     
  8. thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #8
  9. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #9
    no problem - I highly recommend you read the IAPG in its entirety. Lots of good info for future reference
     
  10. thread starter macrumors newbie

    Joined:
    Jan 2, 2009
    #10
  11. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #11
    The key is to incorporate the concepts into your own code. Think of it as a "educational" tutorial rather than a "paint-by-numbers" tutorial. :)
     
  12. macrumors newbie

    Joined:
    Apr 25, 2009
    #12
    I'm lazy too

    Hi, I had the exact same issue and this link helped me out. As you I always enjoy when the source code is attached, I'm too lazy and chances are I won't figure it out by myself :rolleyes:

    Anyways this time it worked out fine for me so here's my source code based on: http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html

    Hope it will help someone else ;)
     

Share This Page