Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 将方向不同的UIViewController按到上一个_Objective C_Ios_Uiviewcontroller_Uinavigationcontroller_Orientation - Fatal编程技术网

Objective c 将方向不同的UIViewController按到上一个

Objective c 将方向不同的UIViewController按到上一个,objective-c,ios,uiviewcontroller,uinavigationcontroller,orientation,Objective C,Ios,Uiviewcontroller,Uinavigationcontroller,Orientation,可能是个简单的问题,但: 我的应用程序在纵向模式下启动(大部分是),但我有一个ViewController,我需要将它推到堆栈上,该堆栈需要在横向模式下打开 我四处搜索,发现您不能使用私有API: [[UIDevice currentDevice]设置方向:UIInterfaceOrientation和scapeLeft] 我还找到了一系列“建议”的解决方法(包括以模式呈现而不是推送,以及推送两个ViewController实例) 然而,我相信一定有更简单的方法来解决这个问题。如果有人知道一种

可能是个简单的问题,但:

我的应用程序在纵向模式下启动(大部分是),但我有一个ViewController,我需要将它推到堆栈上,该堆栈需要在横向模式下打开

我四处搜索,发现您不能使用私有API: [[UIDevice currentDevice]设置方向:UIInterfaceOrientation和scapeLeft]

我还找到了一系列“建议”的解决方法(包括以模式呈现而不是推送,以及推送两个ViewController实例)

然而,我相信一定有更简单的方法来解决这个问题。如果有人知道一种方法可以推到堆栈上(保留树中的导航),使viewcontroller显示为横向,请告诉我

谢谢你们的帮助,伙计们


dunc

使用
UINavigationController
push transition以不同方向显示视图是没有意义的。导航栏/工具栏的方向是什么


呈现模态视图控制器是实现这一点的正确方法。如果这会导致状态栏隐藏,请确保
您的ModalViewController.wantFullScreenLayout

为什么您确定一定有更简单的方法?对我来说,Cannyboy对这个问题的回答相当简单。谢谢罗杰。你说得对,Cannyboy确实有效(我在写这篇文章之前就试过了),我可能最终会使用它。但这意味着状态栏对该viewcontroller是隐藏的。有什么建议我可以保留它吗?