motion/input_helpers.rb
def handle_keyboard_will_show(notification)
      return unless @table

      animationCurve = notification.userInfo.valueForKey(UIKeyboardAnimationCurveUserInfoKey)
      animationDuration = notification.userInfo.valueForKey(UIKeyboardAnimationDurationUserInfoKey)
      keyboardEndRect = notification.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey)
      keyboardEndRect = view.convertRect(keyboardEndRect.CGRectValue, fromView:App.delegate.window)

      UIView.beginAnimations "changeTableViewContentInset", context:nil
      UIView.setAnimationDuration animationDuration
      UIView.setAnimationCurve animationCurve

      intersectionOfKeyboardRectAndWindowRect = CGRectIntersection(App.delegate.window.frame, keyboardEndRect)
      bottomInset = intersectionOfKeyboardRectAndWindowRect.size.height;

      @table.contentInset = UIEdgeInsetsMake(0, 0, bottomInset, 0)

      UIView.commitAnimations


      @table.scrollToRowAtIndexPath(owner_cell_index_path,
          atScrollPosition:UITableViewScrollPositionMiddle,
          animated: true)
    end
def handle_keyboard_will_show(notification)
      return unless @table

      animationCurve = notification.userInfo.valueForKey(UIKeyboardAnimationCurveUserInfoKey)
      animationDuration = notification.userInfo.valueForKey(UIKeyboardAnimationDurationUserInfoKey)
      keyboardEndRect = notification.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey)
      keyboardEndRect = view.convertRect(keyboardEndRect.CGRectValue, fromView:App.delegate.window)

      UIView.beginAnimations "changeTableViewContentInset", context:nil
      UIView.setAnimationDuration animationDuration
      UIView.setAnimationCurve animationCurve

      intersectionOfKeyboardRectAndWindowRect = CGRectIntersection(App.delegate.window.frame, keyboardEndRect)
      bottomInset = intersectionOfKeyboardRectAndWindowRect.size.height;

      @table.contentInset = UIEdgeInsetsMake(0, 0, bottomInset, 0)

      UIView.commitAnimations


      @table.scrollToRowAtIndexPath(owner_cell_index_path,
          atScrollPosition:UITableViewScrollPositionMiddle,
          animated: true)
    end
Keyboard show/hide handlers do this:

 * Reset the table insets so that the
   UITableView knows how large its real
   visible area.
 * Scroll the UITableView to reveal the
   cell that has the +firstResponder+
   if it is not already showing.

 Of course, the process is exactly reversed
 when the keyboard hides.

 An instance variable +@table+ is assumed to
 be the table to affect; if this is missing,
 this code will simply no-op.

 Rejigger everything under the sun when the
 keyboard slides up.

 You *must* handle the +UIKeyboardWillShowNotification+ and
 when you receive it, call this method to handle the keyboard
 showing.