In the above image the top bar is a custom view which I used like whats app application. Keyboard will dismiss interactively with UIScrollView. I have implemented UIKeyboardWillHideNotification
and UIKeyboardDidChangeFrameNotification
to move up and down that view. Now the problem is as I used keyboard will dismiss interactively so when user drag his finger to keyboard, it start move up or down accordingly. But I am not able to get any kind of notification to move up or down the view as well.
While I was searching on this matter, I found three different approaches to achieve this. The easiest is by attaching that custom bar as an input accessory view https://developer.apple.com/documentation/uikit/uiresponder/1621119-inputaccessoryview
You can also attach a dummy view as an input accessory view which emits information about its current location, as described here: https://github.com/brynbodayle/BABFrameObservingInputAccessoryView
Other, the least favourable is to hide the keyboard without any animations and show a captured keyboard static image animating instead, as described here: https://medium.com/@superpeteblaze/ios-custom-keyboard-dismissal-with-swift-9b6df2d9cc49
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With