How Can One Enable Keyboard Like in Imessages/Fb Messenger in Landscape Mode at iOS8

How can one enable keyboard like in iMessages/FB Messenger in landscape mode at iOS8?

The very important thing to do while migrating projects from xCode5.1 (and earlier) to xCode6
is to modify Info.plist file by adding Launch screen interface file base name key

Sample Image

You can event set it to empty string (usually it is a name of the Launch xib). Without this simply line one will have all the problems presented at screenshots above.

The absence of the Launch screen interface file base name results in working in compatibility mode with standard resolution of older devices. Let's run the following code in the project in each case

NSLog(@"bounds = %@", NSStringFromCGRect(UIScreen.mainScreen.bounds));

With Launch xib one gets

bounds = {{0, 0}, {414, 736}} // for iPhone 6Plus

bounds = {{0, 0}, {375, 667}} // for iPhone 6

Without it one gets

bounds = {{0, 0}, {320, 568}}

So, the last case indeed is the compatibility mode.

iOS 8 Orientation change: Keyboard frame does not display correctly

Prior to iOS 8, the keyboard's location and width/height were always relative to portrait orientation when reported to the app. (e.g. Landscape's keyboard width is in the y direction, ~352 pixels on an iPad.)
As of iOS 8, this has been updated to always have (0,0) at the top left of your (physical) view and the width/height reflect the x/y orientation you would normally expect outside of iOS. If you were previously positioning your keyboard via something like keyboardDidShow's [notification userInfo], you are going to get numbers that don't quite make sense. You can use something along these lines to take into account the pre-iOS8 idiosyncrasies:

- (void)keyboardDidShow: (NSNotification *) notification{

NSDictionary *keyboardInfo = [notification userInfo];
CGSize keyboardSize = [[keyboardInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
float height, width;
if(UIInterfaceOrientationIsPortrait(orientation)){
width = keyboardSize.width;
height = keyboardSize.height;
} else {
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1){
width = keyboardSize.height;
height = keyboardSize.width;
} else {
width = keyboardSize.width;
height = keyboardSize.height;
}
}

// Remainder of function
}

Which can be refactored down to...

- (void)keyboardDidShow: (NSNotification *) notification{

NSDictionary *keyboardInfo = [notification userInfo];
CGSize keyboardSize = [[keyboardInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
float width = keyboardSize.width;
float height = keyboardSize.height;
if(!UIInterfaceOrientationIsPortrait(orientation) && (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1)){
width = keyboardSize.height;
height = keyboardSize.width;
}

// Remainder of function
}

Also, the 8.1 update fixed several landscape/rotation bugs likely related to the above change. Grab the update and see if that solves your issue.

iOS8--After changing Orientation Keyboard Disappeared

It seems that you try to build old project in new xCode6.
So the problem can be in the incorrect migration of old projects to new xCode.

Check if you have Launch screen interface file base name key in Info.plist file.

If it is the case please find the full answer here.

iOS8--After changing Orientation Keyboard Disappeared

It seems that you try to build old project in new xCode6.
So the problem can be in the incorrect migration of old projects to new xCode.

Check if you have Launch screen interface file base name key in Info.plist file.

If it is the case please find the full answer here.

Programmatic change interface orientation, but keyboard's orientation isn't same as status bar on iOS 8

This code could fix the problem:

- (void)onFullScreenButtonTouchUpInside:(id)sender
{
[self adjustViewFrameToFullScreen];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
//change the device orientation
if (IsIOS8) {
[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];
}
}

How to detect Orientation Change in Custom Keyboard Extension in iOS 8?

In order to update your custom keyboard when the orientation changes, override viewDidLayoutSubviews in the UIInputViewController. As far as I can tell, when a rotation occurs this method is always called.

Additionally, as the traditional [UIApplication sharedApplication] statusBarOrientation] doesn't work, to determine the current orientation use the following snippet:

if([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height){
//Keyboard is in Portrait
}
else{
//Keyboard is in Landscape
}

Hopefully this helps!

How can I force UIAlertView to display the full message without scrolling when in landscape mode?

  1. It displays on 2 lines because with the new iOS7 style it doesn't fit. There is increased padding, and even without the padding, the new iOS 7 dynamic type kit font sizes prevents you from having any sizing guarantees.
  2. You can't, not without making your own custom UIView, making it look similar but decreasing the padding and locking the font sizes.
  3. The style of the whole OS changed. Although I am surprised they increased the padding so much. I guess with the dynamic font sizes they weren't too worried about keeping backward compatible layouts.


Related Topics



Leave a reply



Submit