Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.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
iOS>&燃气轮机;设备定向>&燃气轮机;屏幕不支持倒置_Ios_Device Orientation - Fatal编程技术网

iOS>&燃气轮机;设备定向>&燃气轮机;屏幕不支持倒置

iOS>&燃气轮机;设备定向>&燃气轮机;屏幕不支持倒置,ios,device-orientation,Ios,Device Orientation,我有一个支持设备定向的屏幕 一切正常,除了当我将设备倒置(顶部的home按钮)时,旋转不起作用(它卡在最后的横向设置上) 我知道有几个地方需要更新以支持这一点: 在VC本身中,我添加了以下方法: 在项目目标中,我更新如下: 在Storyboard VC场景中,我更新如下: 我在这里遗漏了什么?您在真实设备上测试过吗 无论如何,试试这个: - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceO

我有一个支持设备定向的屏幕

一切正常,除了当我将设备倒置(顶部的home按钮)时,旋转不起作用(它卡在最后的横向设置上)

我知道有几个地方需要更新以支持这一点:

  • 在VC本身中,我添加了以下方法:

  • 在项目目标中,我更新如下:

  • 在Storyboard VC场景中,我更新如下:


我在这里遗漏了什么?

您在真实设备上测试过吗

无论如何,试试这个:

- (NSUInteger)supportedInterfaceOrientations {
    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}

还必须允许在当前主视图控制器的每个父视图控制器中旋转到所有方向。例如,如果视图控制器位于导航控制器中,请尝试将其子类化,并重写与示例中相同的方法

编辑:如上所述,由于iOS 7,您可以实现
UINavigationControllerDelegate
方法来返回自定义支持的方向:

- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController

正如@eGanges提到的,关键点可能是对
UITabBarController
进行子类化(并覆盖
supportedInterfaceOrientations
),如果这是您的初始视图控制器,那么在这种情况下,这是您应该子类化的唯一控制器(当然,你应该将所有支持的界面方向添加到你的app Info.plist文件
UISupportedInterfaceOrientions
key)

UIInterfaceOrientationMaskAll
也将涵盖这些。我在真实设备上测试了它,它也有同样的问题。另外,我也尝试了你的建议(使用|操作符)这里也不好……是的,我想这只适用于iPhone上的倒置,因为默认情况下导航控制器不支持这一个。顺便说一句,如果我在导航堆栈上有几个VCs,我希望第一个VCs不可旋转(而后面的是)-似乎一旦我将UINavigationController子类化并将其设置为可旋转,我就无法将其子VC设置为不接受旋转。有什么想法吗?@OhadRegev我认为这是不可能的。请尝试覆盖导航控制器的
supportedinterfaceorients
,以返回其
topViewCon的受支持方向troller
。但是,这并不能阻止以非法方向弹出第一个视图控制器。我看到的唯一解决方案是,当上一个VC不支持当前方向时,禁用“后退”按钮。如果存在UIAbbarController,请注意,您必须子类化并覆盖-(UIInterfaceOrientationTask)支持该类的InterfaceOrientations{}方法(除了UINavigationController之外)。您不再需要子类化nav控制器。您可以将VC设置为委托,并实现
-(UIInterfaceOrientationTask)导航控制器支持的InterfaceOrientations:(UINavigationController*)导航控制器
Look。。。。。。。。