The past week, I found myself solving the same problem multiple times: creating animations that happen contemporaneously with the iOS keyboard animating up. It’s not difficult, but as with many bits of the iOS SDKs there are a lot of fiddly bits to get in order.
If you want to, say, shrink a UIScrollView or adjust its content offset, you have to time the animation of the resize to match that of the keyboard animation or else suffer a jarring jump effect.
Even if you manually figured out what the animation duration and timing curve should be, Apple has been known to change it without warning or documentation even between minor point releases.
The solution I landed on involves grabbing the animation duration and curve out of the NSNotification object itself (an idea taken, admittedly, from StackOverflow). From there, I wrapped it in a convenient helper method reminiscient of UIView’s other animation methods. Nothing here is rocket science, but perhaps this will be useful to you.
Update: This has now been published as its own CocoaPod. If you’re interested in using something like this in your own projects, check it out!