SergioM February 2016

UITableView inside view container cut of when keyboard shown

I currently have a view with a container view and other controls. The container view has a static table, and in this table the cells have text fields. When the keyboard shows up it always cut off some content of the table. I can't seem to scroll the table to see the rest of the content.

An example of the layout is:

  • Main view: height device height
    • scroll view: device height with content size 800
      • container view: height 600
        • table view: height 600
      • button one: height 45
      • button two: height 45

I tried registering to the keyboard notification and adding an inset manually, didn't work. Checked the viewWillAppear() and has the super call (suggested fix in a question).

The problem is not that the text field is not visible. The problem is that once the keyboard is shown, the elements at the bottom of the view are not visible and scrolling does not work (scrolls but not all the way down).

Answers


SergioM February 2016

OK, so after trying a few things I had to change the content size of the scroll view (subtract the keyboard size) instead of changing the insets in the table view controller when keyboard displayed. That did the trick.

Post Status

Asked in February 2016
Viewed 3,535 times
Voted 7
Answered 1 times

Search




Leave an answer