How to get the size of a third-party keyboard in iOS 8?

I installed Swift Keyboard on my phone 5 with iOS 8.

The original method (Objective-C) for getting the keyboard size only works with the system keyboard, for example:

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

If I use Swift Keyboard ... keyboardSize.height is zero. How to get the size of a third-party keyboard in iOS 8?

Thanks.

+5
source share
1 answer

I think that since you get the size before the keyboard was actually displayed.

Try replacing:

 objectForKey:UIKeyboardFrameBeginUserInfoKey 

FROM

 objectForKey:UIKeyboardFrameEndUserInfoKey 

This works for me with SwiftKey!

+8
source

Source: https://habr.com/ru/post/1202853/


All Articles