atastrophic
atastrophic

Reputation: 3143

iOS 8 Orientation Issues : Keyboard ends up in incorrect position

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

Upvotes: 5

Views: 1774

Answers (5)

dmaltsev
dmaltsev

Reputation: 1

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!

Upvotes: 0

user4519386
user4519386

Reputation: 1

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

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];

Upvotes: 0

Ankush Dhawan
Ankush Dhawan

Reputation: 319

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

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

Upvotes: 0

My3
My3

Reputation: 197

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.

Upvotes: 0

Gui13
Gui13

Reputation: 13561

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.

Upvotes: 5

Related Questions