iOS键盘的高度(以像素为单位)是多少?

iOS键盘的高度(以像素为单位)是多少?,ios,keyboard,Ios,Keyboard,这是出于图形设计的原因,因此高度以像素为单位是首选。 我认为如果是这样的话,不同语言的键盘可能会有不同的高度。那么美国/英国键盘的高度会更好吗?您应该通过编程获得它,这是最好的方式,注册通知: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (keyboardDidShow:) name: UIKeyboardDidShowNotification object:nil]; 然后获取帧: -(v

这是出于图形设计的原因,因此高度以像素为单位是首选。
我认为如果是这样的话,不同语言的键盘可能会有不同的高度。那么美国/英国键盘的高度会更好吗?

您应该通过编程获得它,这是最好的方式,注册通知:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (keyboardDidShow:) name: UIKeyboardDidShowNotification object:nil];
然后获取帧:

-(void) keyboardDidShow: (NSNotification *)notif
{
    NSDictionary* info = [notif userInfo];
    NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
    CGRect keyboardFrame = [aValue CGRectValue];
}

这有帮助

无论何时显示,您都可以获得键盘的高度:

//add this line to viewDidLoad    
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBordShown name:UIKeyboardDidShowNotification object:nil];

- (void)keyBordShown:NSNotification*)notification
{
    NSDictionary* keyboardInfo = [notification userInfo];
    NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey];
    CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue];
}

因为这比静态设置键盘高度更好。

可能的键盘复制品在iPad上可能有许多不同的形状。