Sample project for my blog post, Smoothly reacting to keyboard visibility changes.
The implementation for detecting keyboard visibility and animating size change can be found in FluidContentResizer and its usage here. It's a tiny project so feel free to simply copy over the necessary files to your project.