iOS 8 Orientation Issues : Keyboard ends up in incorrect position

1.7k views Asked by At

I have a universal project for iOS that was created in xCode 5 that I am trying to port to xCode 6. Everything seems to have been fine since I am not using LaunchScreen and iPhone 6 and 6 Plus scale the application to their resolutions.

The problem occurs when device changes its orientation.

Scenario:

It only occurs on iPhone 6 and 6 Plus.

Open Login screen with username and password fields. Rotate the device to Landscape, and tap username or password field. The keyboard appears in the middle of the screen with half cut. Rotating back to portrait hides the keyboard altogether and it no longer appears on screen no matter which field you tap on.

To get the keyboard back, rotate back to Landscape, tap on a field rotate device to opposite Landscape (don't let it go in Portrait). The keyboard suddenly becomes normal and acts fine.

Problematic Keyboard

5

There are 5 answers

0
Gui13 On

I got the same problem, and that's because your app is launched in scaled mode.
It seems that Apple didn't go the full blown way to handle landscape in this scaled mode.

The solution is to switch to non-scaled mode for the iPhone 6-6Plus, using the trick specified here: How to enable native resolution for apps on iPhone 6 and 6 Plus?

Note that this will likely break a lot of your screens in the process.. but there's no other solution.

0
My3 On

I have faced this issue with scalable mode of the app. Though supporting non-scalble mode (by adding iPhone 6 & 6+ launch images to xcassets) solves this problem, it was not permissible in my case as screens had static layout for each orientation. I could solve this problem by avoiding the incidents of changing the root view controller of the window. Instead, the new view controllers have been added (with balancing removal) as subview (and hence childViewController) to the existing root view controller.

0
Ankush Dhawan On

Everything is ok on iOS6/7, But not iOS8.

The orientation of the keyboard on iOS 8 is not the same as status bar.

1
user4519386 On

If your application runs only portrait mode you can stop generating orientation notifications;

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
0
dmaltsev On

I have faced this issue, and after some research I found some stuff, that caused such bug. In my AppDelegate I changed window rootViewController to show different ViewControllers depends of authorization status

if (!auth)
{
    self.window.rootViewController = [[AuthViewController alloc] init];
} else {
    self.window.rootViewController = [[DataViewController alloc] init];
}

I removed this and move controller select logic to NavigationViewController

if (!auth)
{
    self.viewControllers = @[[[AuthViewController alloc] init]];
} else {
    self.viewControllers = @[[[DataViewController alloc] init]];
}

and make this NavigationViewController as Storyboard initial view controller.

Hope it helps!