Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: keyboard blocks screen [duplicate]

Possible Duplicate:
UITableView and keyboard scrolling issue

I've got a screen which has several text fields (UITextField) for gathering information from the user which ends up taking up most of the screen. when the user selects a field the soft keyboard appears (as expected) but it covers up the fields that appear further down on the screen. In order to get to those fields the user has to close the keyboard and select them, and upon doing so, the field is covered up again and the user can't see what they're typing.

I tried wrapping the text fields in a UIScrollView, hoping that when the keyboard took up space on the screen i would be able to scroll the uppper portion of the screen down to the other text fields, but this did not work.

I'm hoping to get this scrolling behavior. Does anyone know how to do it?

-TIA

like image 963
mtmurdock Avatar asked Jan 20 '11 16:01

mtmurdock


2 Answers

You need to adjust the height of your scroll view when the keyboard appears so that it doesn't overlap. See Managing the Keyboard in the programming guide.

like image 174
Brian Avatar answered Oct 09 '22 01:10

Brian


There's a good answer to a similar question and some sample code here.

Basically, you register to receive the UIKeyboardWillShowNotification and the UIKeyboardWillHideNotification, then you manually scroll the view to compensate.

like image 21
djeckhart Avatar answered Oct 09 '22 01:10

djeckhart