Get keyboard size on iOS 8 not working with external keyboard

后端 未结 1 1429
粉色の甜心
粉色の甜心 2021-01-20 01:38

Been looking at several SO post now, but none seem to help me. Just want a UITableViews bottom constraint to be set so that the keyboard never is on top of the

相关标签:
1条回答
  • 2021-01-20 02: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)

    0 讨论(0)
提交回复
热议问题