1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Keyboard is hiding UITextField

Discussion in 'iPhone/iPad Programming' started by mcnuggets, Jan 16, 2009.

  1. macrumors newbie

    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

    Scroll the view up so it's visible or make sure the textfield is also high enough to not get hidden.
  3. macrumors newbie

    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

    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


    Staff Member

  6. macrumors 603


  7. macrumors newbie

    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. macrumors newbie

  9. macrumors 603


    no problem - I highly recommend you read the IAPG in its entirety. Lots of good info for future reference
  10. macrumors newbie

  11. Moderator


    Staff Member

    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

    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