Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.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 呈现强制横向的模态视图控制器_Objective C_Ios_Cocoa Touch_Uiviewcontroller_Modalviewcontroller - Fatal编程技术网

Objective c 呈现强制横向的模态视图控制器

Objective c 呈现强制横向的模态视图控制器,objective-c,ios,cocoa-touch,uiviewcontroller,modalviewcontroller,Objective C,Ios,Cocoa Touch,Uiviewcontroller,Modalviewcontroller,我从一个表视图(忽略内存泄漏,只是测试…)中展示了一个这样的模态视图控制器: 在我的签名EVC中,我实施了以下内容: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); } 我希望SignatureVC仅处于横向模式

我从一个表视图(忽略内存泄漏,只是测试…)中展示了一个这样的模态视图控制器:

在我的签名EVC中,我实施了以下内容:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
我希望SignatureVC仅处于横向模式。但是,在显示模态视图控制器后,方向不会改变。
我做错了什么?谢谢。

方法
-应该自动旋转指针面方向:
不会旋转接口方向。如果设备方向旋转,它仅允许接口方向旋转

如果设备处于纵向时出现模式视图,则它将处于纵向。但是,一旦旋转到landscapeLeft,它将使用此代码在该方向上保持锁定

要强制旋转界面,可以使用

[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
对于最低部署目标为IOS 6.0的应用程序,可以发挥神奇的作用。试试这个

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

-(BOOL)shouldAutorotate {
    return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

-(BOOL)shouldAutorotate {
    return NO;
}