tran minh
tran minh

Reputation: 21

How to get height of emoji keyboard in iOS 11 when switching input type immediately?

I am using the code below:

CGRect keyboardFrame = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];

but it doesn't work exactly.

Upvotes: 2

Views: 1357

Answers (2)

Wiingaard
Wiingaard

Reputation: 4302

When switching to emoji keyboard by pressing the language selector button (the globe), it seems that a UIKeyboardWillChangeFrame-notification gets sent. But when changing by long pressing the language selector button, no notification is sent.

It looks to me as a bug in iOS 11, since even the apple messages app and facebook messenger app doesn't handle this right. I've submitted a radar about this with id: 36657137

Upvotes: 2

Andrew Romanov
Andrew Romanov

Reputation: 5066

You can subscribe to notifications: UIKeyboardWillChangeFrame or UIKeyboardDidChangeFrame . In handlers you can get the end frame of the keyboard.
Here I’ve created an example application.

Upvotes: 4

Related Questions