The height in portrait and the height in landscape measured in points.
To make your iPhone keyboard bigger, change your display settings to make the entire UI bigger. Alternatively, you can install a third-party app such as Larger Keyboard or TuneKey. If you don't like the results, you can buy an iPhone Pro Max and upgrade to a bigger display.
In apps on iPhone, you can use the onscreen keyboard to enter and edit text. You can also use Magic Keyboard and Dictation to enter text.
You can turn the split keyboard off in Settings>General>Keyboard>Split Keyboard>Off. You can turn the split keyboard off in Settings>General>Keyboard>Split Keyboard>Off.
Check and see if your iPhone's portrait orientation lock is in the top screen status bar. If so, turn it off by swiping up from screen bottom to open the Control Center, then tap to unlock. to learn more about control center, check out this article.
I used the following approach for determining the frame of the keyboard in iOS 7.1.
In the init method of my view controller, I registered for the UIKeyboardDidShowNotification
:
NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(keyboardOnScreen:) name:UIKeyboardDidShowNotification object:nil];
Then, I used the following code in keyboardOnScreen:
to gain access to the frame of the keyboard. This code gets the userInfo
dictionary from the notification and then accesses the NSValue
associated with UIKeyboardFrameEndUserInfoKey
. You can then access the CGRect and convert it to the coordinates of the view of your view controller. From there, you can perform any calculations you need based on that frame.
-(void)keyboardOnScreen:(NSNotification *)notification { NSDictionary *info = notification.userInfo; NSValue *value = info[UIKeyboardFrameEndUserInfoKey]; CGRect rawFrame = [value CGRectValue]; CGRect keyboardFrame = [self.view convertRect:rawFrame fromView:nil]; NSLog(@"keyboardFrame: %@", NSStringFromCGRect(keyboardFrame)); }
Swift
And the equivalent implementation with Swift:
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow), name: UIResponder.keyboardDidShowNotification, object: nil) @objc func keyboardDidShow(notification: Notification) { guard let info = notification.userInfo else { return } guard let frameInfo = info[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return } let keyboardFrame = frameInfo.cgRectValue print("keyboardFrame: \(keyboardFrame)") }
Do remember that, with iOS 8, the onscreen keyboard's size can vary. Don't assume that the onscreen keyboard will always be visible (with a specific height) or invisible.
Now, with iOS 8, the user can also swipe the text-prediction area on and off... and when they do this, it would kick off an app's keyboardWillShow
event again.
This will break a lot of legacy code samples, which recommended writing a keyboardWillShow
event, which merely measures the current height of the onscreen keyboard, and shifting your controls up or down on the page by this (absolute) amount.
In other words, if you see any sample code, which just tells you to add a keyboardWillShow
event, measure the keyboard height, then resize your controls' heights by this amount, this will no longer always work.
In my example above, I used the sample code from the following site, which animates the vertical constraints constant
value.
Practicing AutoLayout
In my app, I added a constraint to my UITextView
, set to the bottom of the screen. When the screen first appeared, I stored this initial vertical distance.
Then, whenever my keyboardWillShow
event gets kicked off, I add the (new) keyboard height to this original constraint value (so the constraint resizes the control's height).
Yeah. It's ugly.
And I'm a little annoyed/surprised that Xcode 6's horribly-painful AutoLayout doesn't just allow us to attach the bottoms of controls to either the bottom of the screen, or the top of onscreen keyboard.
Perhaps I'm missing something.
Other than my sanity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With