Get keyboard size on iOS 8 not working with external keyboard

天涯浪子 提交于 2019-12-01 22:09:35

You can detect if external keyboard is connected and and set keyboard's height to 0 by doing something like that.

Objective-C version:

CGRect finalKeyboardFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
finalKeyboardFrame = [self convertRect:finalKeyboardFrame fromView:self.window];

NSLog(@"origin.y: %f", finalKeyboardFrame.origin.y);

Shows the y coordinate properly depending if external keyboard is connected or not:

origin.y: 258.000000 (not connected)

origin.y: 474.000000 (connected)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!