8

I have a table view with 4 text fields in 1st section and 2 switches in second section. The second section has a custom footer with a button. When I click on any text field, the footer of the second section also moves up along with the keyboard. How can I prevent this?

Vidyalaxmi
  • 309
  • 1
  • 5

1 Answers1

0

Sounds like your constraint changes on KeyboardWillShow/WillHide events are working, but not in the way you want. The footer basically floats at the bottom of the tableview, so it sounds like when the table height is recalculated for WillShow it's setting the bottom table constraint equal to the top of the keyboard - which is usually what you want. If the constraints are updating properly and you want to obscure the footer, then you can just offset the constraint by the height of the footer.

 |                                 |
 |                                 |
 0  bottom of table                |
--- top of the keyboard           --- top of the keyboard
                                   |
                                  -Y 
Y = height of footer              --- bottom of table 

The other option to toggle show/hide mentioned by @JD works, it just depends on the behavior you want for users. While editing the text fields will they need content in the footer?

suite22
  • 476
  • 3
  • 16