Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.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
Segue IOS7之后的ViewController方向不正确_Ios_Uiviewcontroller_Orientation_Segue_Landscape - Fatal编程技术网

Segue IOS7之后的ViewController方向不正确

Segue IOS7之后的ViewController方向不正确,ios,uiviewcontroller,orientation,segue,landscape,Ios,Uiviewcontroller,Orientation,Segue,Landscape,我有两个视图控制器,主视图控制器带有shouldAutoRotate NO,第二个视图控制器带有shouldAutoRotate YES。 我使用函数presentViewController:演示第二个ViewController,并使用UIModalPresentationCurrentContext,因为我在第二个ViewController上有一个透明的背景,可以在后面查看第一个ViewController 问题是,当我在横向视图中的第一个ViewController中时,由于shoul

我有两个视图控制器,主视图控制器带有shouldAutoRotate NO,第二个视图控制器带有shouldAutoRotate YES。 我使用函数presentViewController:演示第二个ViewController,并使用UIModalPresentationCurrentContext,因为我在第二个ViewController上有一个透明的背景,可以在后面查看第一个ViewController

问题是,当我在横向视图中的第一个ViewController中时,由于shouldAutoNote否而出现在纵向视图中,并且我呈现第二个ViewController时,第二个ViewController正好出现在横向视图中,但是如果我将iPhone旋转回纵向视图,我将不会旋转,除非我将手机旋转回横向,否则是什么让方向恢复正常

状态栏的行为总是正确的,问题在于ViewController

有什么建议吗

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

-(NSUInteger)supportedInterfaceOrientations
{
        return UIInterfaceOrientationMaskAll;
}

您只需在当前视图控制器中提供所需的方向类型。

shouldAutorotateToInterfaceOrientation自ios5以来不再受支持,而且这并不能真正解决本文中描述的问题,谢谢!!