7
votes

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.

2
Use UITextField's delegate method for Keyboard show and hide.Rushi trivedi
@Rushi Which delegate method you are talking about?Tapas Pal
u solved? I've the same problemMassimo Polimeni
No.. :( I changed to dismiss from dismissInteractivelyTapas Pal
@MassimoPolimeni you solved?Tapas Pal

2 Answers

3
votes

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

-4
votes

The keyboard follows the dragging touch offscreen, and can be pulled upward again to cancel the dismiss.

scrollView.keyboardDismissMode = .Interactive

see the Documentation UIScrollViewKeyboardDismissModeInteractive

hope its helpful