Check out How to adjust layout for UISearchBar keyboard by JR. Here is an excerpt:
See previous post for how to add and hook up a search bar. Setup something like this.
Center the label.
But also give it a custom height.
We are going to calculate the value and turn that constraint ON/OFF depending on whether the keyboard is displayed or not.
Drag out the two constraints…