Listen to keyboard notifications. There you can obtain the following information and animate your button accordingly.
UIKeyboardAnimationCurveUserInfoKey The key for an NSNumber object containing a UIViewAnimationCurve constant that defines how the keyboard will be animated onto or off the screen.
Available in iOS 3.0 and later.
Declared in UIWindow.h.
UIKeyboardAnimationDurationUserInfoKey The key for an NSNumber object containing a double that identifies the duration of the animation in seconds.
Available in iOS 3.0 and later.
Declared in UIWindow.h.
More information here: https://developer.apple.com/library/ios/documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html#//apple_ref/doc/constant_group/Keyboard_Notification_User_Info_Keys