Is there any way to detect keyboard types changes with the size, type and suggestion bar height, change like from English keyboard to Hindi which contains some kind of suggestion bar (see screenshot).
Normal English Keyboard
First Problem
After changing to Hindi LIPI - When just I changed, everthing is fine because size of english and hindi keyboard is same, but after start typing Hindi Lipi suggestion cover the TextField
Second Problem
After changing to Emoji - Emoji keyboard hight little bit more as compare to english, So again keyboard cover the TextField
.
Add an observer for a notification named "UIKeyboardWillChangeFrameNotification".
The "userInfo" dictionary for the notification has multiple frames of the keyboard on the screen.
adding an observer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logNotification:) name:UIKeyboardWillChangeFrameNotification object:nil];
selector with the logger
- (void)logNotification:(NSNotification *)notification {
NSLog(@"%@", notification);
}
userInfo dictionary content
userInfo = {
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = 0;
UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 216}}";
UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 441.5}";
UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 460}";
UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 315}, {320, 253}}";
UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 352}, {320, 216}}";
UIKeyboardIsLocalUserInfoKey = 1;
}}
Same problem i too faced. And I resolved by using below code
CGSize keyboardSize = [aNotification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
Use UIKeyboardFrameEndUserInfoKey instead of using UIKeyboardFrameBeginUserInfoKey.
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