本文介绍了iOS-强制键盘以横向显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我已经通过CGAffineTransform在横向模式下创建了视图.在我的应用中,我以纵向模式显示了每个视图.但是,正如我告诉您的那样,我已经通过CGAffineTransform在横向中创建了一个视图,因为我必须在横向模式下在该视图上显示电子表格.但是我逻辑上做到了,键盘没有在横向模式下显示.请给我代码以横向模式显示键盘.

My question is that I have created the view by CGAffineTransform in landscape mode. In my app I have shown each view in portrait mode. But as I told you I have created one view by CGAffineTransform in landscape, because I have to show a spreadsheet on that view in landscape mode. But I did it logically and the keyboard is not showing in landscape mode. Please give me the code to show the keyboard in landscape mode.

推荐答案

为此问题设置视图:

(BOOL)shouldAutorotate
{
    return NO;
}

,这在viewDidLoad中

and this in viewDidLoad

 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];

我知道这听起来很奇怪,但是确实可以.

I know this sounds odd, but it does work.

这篇关于iOS-强制键盘以横向显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 13:19