开发者

iPhone: keyboard blocks screen [duplicate]

This question already has answers here: Closed 10 years ago.

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 开发者_Python百科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


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.


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.


This is a drag and drop framework that I use in my projects as I have come across this problem a lot. It's a UIScrollView subclass and supports different auto-focus modes and a variety of other bits and bobs.

https://github.com/mackross/GTKeyboardHelper

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜