Smooth keyboard animation in iOS

If you ever had handle keyboard show/hide animations especially while building chat applications which need to move the visible view up when keyboard shows up — here is the right way of doing it (no flicker, no hard coding)

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:[notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]];
[UIView setAnimationCurve:[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]];
[UIView setAnimationBeginsFromCurrentState:YES];
# do work
[UIView commitAnimations];
Like what you read? Give Shon Saoji a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.