Keyboard iOS8键盘方向

Keyboard iOS8键盘方向,keyboard,ios8,orientation,Keyboard,Ios8,Orientation,在我们的应用程序中,我们总是强制屏幕的方向。在iOS8之前,键盘的方向与状态栏的方向相关联,但现在在iOS8中似乎不是这样 现在我们看到的情况是,我们的屏幕(和状态栏)将在横向方向正确,但键盘仍将在纵向方向。要进行纠正,我们必须在键盘显示在横向屏幕之前,将设备从横向移动到纵向再移动到横向屏幕 如果键盘方向不再绑定到状态栏,是否有方法也强制键盘方向 编辑: 此代码在iOS6和7下工作。它用于更改状态栏的方向(也用于更改键盘的方向)和变换屏幕 [UIApplication share

在我们的应用程序中,我们总是强制屏幕的方向。在iOS8之前,键盘的方向与状态栏的方向相关联,但现在在iOS8中似乎不是这样

现在我们看到的情况是,我们的屏幕(和状态栏)将在横向方向正确,但键盘仍将在纵向方向。要进行纠正,我们必须在键盘显示在横向屏幕之前,将设备从横向移动到纵向再移动到横向屏幕

如果键盘方向不再绑定到状态栏,是否有方法也强制键盘方向

编辑: 此代码在iOS6和7下工作。它用于更改状态栏的方向(也用于更改键盘的方向)和变换屏幕

        [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 );
        }

在iOS8之前,键盘方向与状态栏的方向绑定,但在iOS8中,键盘方向与设备的方向绑定。您可以使用以下代码强制设备定向

// 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"];

欢迎来到StackOverflow。你能用短语表达你的问题,说明你已经尝试了什么,或者你研究了什么吗?这个问题似乎太宽泛了。谢谢,我添加了我们用来转换屏幕的代码。