Facebook animation and keyboard controls

Does anyone know how to implement a composer and keyboard that appear, like in a Facebook messenger?

After scrolling up the table, the keyboard appears from the bottom smoothly and without any transitions. In my similar implementation, it works as follows: after scrolling, when the bottom offset tableView <0, the text input field composerBar becomes the first responder, and the keyboard moves to the finger. Yes, I am using UIScrollViewKeyboardDismissModeInteractive .

How does Facebook realize this fluid animation?

keyboard

Edit: I am trying to explain how this works in Facebook Messenger, step by step.

I have an InputAccessoryView on my viewController (TableViewController). Then I start to scroll up the TV (Fig. 1)

enter image description here

Then, if the bottom insertion becomes larger than some value (for example, 10) (Fig. 2), I set firstResponder to inputTextField (Fig. 3)

enter image description hereenter image description here

So, in the general case, with the "UIScrollViewKeyboardDismissModeInteractive" the keyboard switches to the finger position (Fig. 4) enter image description here

BUT! In Facebook Messenger, the keyboard drags from below with equal distance to the distance traveled by the finger. (fig. 5)

enter image description here

So, facebook messenger somehow controls the movement of the keyboard. Question: how?

+5
source share
1 answer

What you are looking for is viewing input accessories

This is a UITextView / UITextField property that allows you to customize the custom view that will be displayed above the system keyboard.

0
source

All Articles