IOS8 UIKeyboardWillShowNotification Third Keyboard Height

I have a user interface that needs some position settings when the keyboard is displayed.

When a keyboard is detected, the following is displayed:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 

Note. I tried with both UIKeyboardWillShowNotification and UIKeyboardDidShowNotification

 - (void)keyboardWillShow:(NSNotification *)n { if (isKeyboardShowing) return; NSDictionary* userInfo = [n userInfo]; // get the size of the keyboard CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; // Animate keyboard shift [self.view layoutIfNeeded]; [UIView animateWithDuration:0.2f animations:^{ // some animation here } completion:^(BOOL finished) { if (finished) isKeyboardShowing = YES; }]; 

For custom keyboards, the keyboard size returns {320, 0}. Since the keyboard can now have different heights, I cannot have static values ​​to change the user interface when the keyboard is displayed.

Is this a problem with ios8? and are there any other methods for dynamically increasing the height of the keyboard?

Edit: this is a UserInfo Dict:

 {name = UIKeyboardDidShowNotification; userInfo = { UIKeyboardAnimationCurveUserInfoKey = 7; UIKeyboardAnimationDurationUserInfoKey = "0.25"; UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {320, 0}}"; UIKeyboardCenterBeginUserInfoKey = "NSPoint: {160, 568}"; UIKeyboardCenterEndUserInfoKey = "NSPoint: {160, 568}"; UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 568}, {320, 0}}"; UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 568}, {320, 0}}"; }} 

Thanks in advance.

+7
ios objective-c ios8 xcode6 keyboard
source share
1 answer

Use

 CGSize keyboardSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; 

to get the actual size of the keyboard

+11
source share

All Articles