Reputation: 1395
I expected the keyboardWillChangeFrame to be called for every point when dragging the keyboard up or down. I am using keyboardDismissMode = .interactive.
Instead, keyboardWillChangeFrame is only called when the keyboard is only fully opened or closed.
Is there a different way to get the effect I want?
Upvotes: 2
Views: 1833
Reputation: 203
i am using this code to get exact frame of keyboard everytime it did end change so if you will change keyboard to english or emoji it will give right frame every time..
func keyboardWillChangeFrame(notification: NSNotification) {
if let keyboardFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
let keyboardHeight = keyboardFrame.size.height
print("keyboard height: \(keyboardHeight)")
self.bottomConstrainttypeTextView.constant = -keyboardHeight
self.view.layoutIfNeeded()
}
}
this how you can use it just add observer for notification for keyboard change trigger
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillChangeFrame(notification:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil)
Upvotes: 0
Reputation: 2842
It's pretty easy to add interactive panning using this repo:
https://github.com/totocaster/Typist
Upvotes: 1