2
votes

In our application we always force the orientation of the screen. Before iOS8 the orientation of the keyboard was tied to the orientation of the status bar but that doesn't seem to be the case now in iOS8.

Now the situation we're seeing is that our screen (and the status bar) will be correctly oriented in landscape but the keyboard will still be in portrait. To correct we have to physically move the device from landscape to portrait to landscape before the keyboard will show in landscape.

If the keyboard orientation is no longer tied to the status bar is there a way to also force the orientation of the keyboard?

Edit: This code works under iOS6 and 7.It's used to change the orientation of the status bar (which used to also change the orientation of the keyboard) and transform the screen.

        [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
        if( isIpad() )
        {
            self.navigationController.view.center = CGPointMake( 374.0, 512.0 );
            self.navigationController.view.transform = CGAffineTransformMakeRotation( GlobalInfo::degreesToRadians( 90 ) )  ;
            self.navigationController.view.bounds = CGRectMake( 0, 0, 1024, 748 );
        }
        else
        {
            self.navigationController.view.center = CGPointMake( 150.0, 240.0 );
            self.navigationController.view.transform = CGAffineTransformMakeRotation( GlobalInfo::degreesToRadians( 90 ) )  ;
            self.navigationController.view.bounds = CGRectMake( 0, 0, 480, 300 );
        }
1
Welcome to StackOverflow. Can you please phrase your question showing what you have already tried, or what you have researched? This question appears to be too broad.Sablefoste
Thanks, I added the code we use to transform the screen.Emmo213

1 Answers

1
votes

Pre-iOS8 they keyboard orientation was tied to the orientation of the status bar but in iOS8 it's tied to the orientation of the device. You can force the orientation of the device with the following code.

// Note that UIInterfaceOrientationLandscapeLeft is equal to UIDeviceOrientationLandscapeRight (and vice versa).
// This is because rotating the device to the left requires rotating the content to the right.

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];