What is the height of iPad's onscreen keyboard?
I'm looking for two numbers here: the height in portrait and the height in landscape. Don't answer in cm or inches, but rather in pixels.
The portrait height is 264 while the landscape height is 352.
I know this is a late answer, but I just came across this question myself.
- (void) keyboardWasShown:(NSNotification *)nsNotification {
NSDictionary *userInfo = [nsNotification userInfo];
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
NSLog(@"Height: %f Width: %f", kbSize.height, kbSize.width);
// Portrait: Height: 264.000000 Width: 768.000000
// Landscape: Height: 352.000000 Width: 1024.000000
}
The answer is: it depends.
I am aware of 16 different heights the keyboard can be, and it can be in any position.
It is different for:
- landscape/portrait,
- webview/non-webview,
- asian character selection style, regular language
- split keyboard / non-split
I have attached an image showing some different possible configurations.
Rather than enumerating all 16 possibilities, I think you want to observe UIKeyboardWillShowNotification
/UIKeyboardWillHideNotification
and UIKeyboardDidChangeFrameNotification
(iOS 5.0+), and then get the keyboard's frame from those events.