Hassy Hassy -3 years ago 170
iOS Question

iOS 11 - Keyboard Height is returning 0 in keyboard notification

I have been using Keyboard notifications without any problem and getting exact height of Keyboard.

- (void)keyboardDidShow:(NSNotification *) notification{
CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;


but with iOS 11 the size of keyboard is 0 when the notification is called.

What is the problem occurring in this scenario? I am using xcode 9 Beta 5

Answer Source

Use this:

CGSize keyboardSize = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download