- Use auto layout in your nib/xib/storyboard.
- Have precisely one constraint be glued to the bottom guide, and make it the highest priority.
- Add this class to your project.
- Change the class of that one special constraint to match this class.
Now, whenever the keyboard shows or hides or changes height (for example when switching between English and Japanese), the rest of your layout will automatically get out of the way.
How it works: every time the top of the keyboard moves up or down, the distance encoded in this constriant changes by the exact same amount. There's no need to initialize it or anything, it registers for the right events all by itself on being loaded from the nib/xib/storyboard. Just make sure there's only one instance of this class, and it's used by the one constraint that's glued to the bottom guide, and that you have all your other bottom-related constraints cascade from that, and it will all just work.