I want to create a simple UIView over keyboard works in AutoLayout.
Here is an example of Yik Yak UIView.
I checked Show UIView with buttons over keyboard, like in Skype,Viber messengers (Swift, iOS) but didn't works well.
I want to create a simple UIView over keyboard works in AutoLayout.
Here is an example of Yik Yak UIView.
I checked Show UIView with buttons over keyboard, like in Skype,Viber messengers (Swift, iOS) but didn't works well.
Instead of using notifications, calculating sizes etc., why not use the inputAccessoryView
? here is an example from Apple: https://developer.apple.com/library/ios/samplecode/KeyboardAccessory/Introduction/Intro.html
So, because of the availability of custom keyboards in iOS 8, you need to do few things in order to achieve view above the keyboard.
UIKeyboardWillShowNotification
and
UIKeyboardWillHideNotification
, this will make sure you got the
newest frame of the keyboard.UIKeyboardWillShowNotification
and
UIKeyboardWillHideNotification
fire up, you can get the frame of
the keyboard like:
notification.userInfo[UIKeyboardFrameEndUserInfoKey]
, then change
the bottom constraint you have in your ViewController accordingly (+ when showing, - when hiding).