PDA

View Full Version : Keyboard is hiding UITextField




mcnuggets
Jan 16, 2009, 11:50 AM
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?



detz
Jan 16, 2009, 11:52 AM
Scroll the view up so it's visible or make sure the textfield is also high enough to not get hidden.

mcnuggets
Jan 16, 2009, 12:15 PM
Scroll the view up so it's visible or make sure the textfield is also high enough to not get hidden.

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.

detz
Jan 16, 2009, 12:29 PM
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.

dejo
Jan 16, 2009, 12:47 PM
I think your answer lies here: Sliding UITextFields around to avoid the keyboard (http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html)

jeremy.king
Jan 16, 2009, 12:47 PM
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TextandWeb/chapter_7_section_3.html#//apple_ref/doc/uid/TP40007072-CH20-SW7

mcnuggets
Jan 16, 2009, 01:04 PM
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.

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?

mcnuggets
Jan 16, 2009, 01:10 PM
I think your answer lies here: Sliding UITextFields around to avoid the keyboard (http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html)

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TextandWeb/chapter_7_section_3.html#//apple_ref/doc/uid/TP40007072-CH20-SW7

Thank you dejo and kingjr3. I got the chills when I saw your replies. It's exactly what i was looking for. Let me check these out. Again thanks. This forum is awesome I tell you. :D

jeremy.king
Jan 16, 2009, 01:10 PM
no problem - I highly recommend you read the IAPG in its entirety. Lots of good info for future reference

mcnuggets
Jan 16, 2009, 01:57 PM
I think your answer lies here: Sliding UITextFields around to avoid the keyboard (http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html)

I wish he provided the source code for this :cool: ... but it's good no doubt. I'm trying it now.

dejo
Jan 16, 2009, 02:00 PM
I wish he provided the source code for this :cool: ... but it's good no doubt. I'm trying it now.
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. :)

sebgaag
Apr 25, 2009, 02:26 PM
I wish he provided the source code for this :cool: ... but it's good no doubt. I'm trying it now.

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 (http://www.gaag.eu/xcode/textfield.zip) based on: http://cocoawithlove.com/2008/10/sliding-uitextfields-around-to-avoid.html

Hope it will help someone else ;)