Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView: Keyboard dismiss interactively

enter image description here

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.

like image 990
Tapas Pal Avatar asked May 18 '16 10:05

Tapas Pal


1 Answers

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

like image 151
Sudara Avatar answered Oct 20 '22 01:10

Sudara