Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.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 显示的UIViewController拒绝横向布局_Ios_Objective C_Iphone_Uiviewcontroller_Uiinterfaceorientation - Fatal编程技术网

Ios 显示的UIViewController拒绝横向布局

Ios 显示的UIViewController拒绝横向布局,ios,objective-c,iphone,uiviewcontroller,uiinterfaceorientation,Ios,Objective C,Iphone,Uiviewcontroller,Uiinterfaceorientation,我正在更新一个5年前的应用程序(最初是为iOS 3编写的!)。我在使用autolayout和解决弃用警告方面取得了不错的进展。但当设备旋转时,用于显示不同视图控制器的旧技术不再可靠 - (void)orientationChanged:(NSNotification *)notification { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;

我正在更新一个5年前的应用程序(最初是为iOS 3编写的!)。我在使用autolayout和解决弃用警告方面取得了不错的进展。但当设备旋转时,用于显示不同视图控制器的旧技术不再可靠

- (void)orientationChanged:(NSNotification *)notification {
            UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
            if (deviceOrientation == UIInterfaceOrientationLandscapeRight && !showingOtherVC) {
                // switch to other VC
                othervc.modalPresentationStyle = UIModalPresentationOverFullScreen;
                [self presentViewController:othervc animated:YES completion:nil];
                [self resignFirstResponder];
             }
另一个视图控制器确实出现了,但它是横向布置的,用于纵向屏幕,而不是横向屏幕,即使设备是横向的

我如何才能以一种相当简单的方式更新它(即,不在Swift中重写,不使用情节提要重新构造应用程序-Xcode似乎无法通过复制/粘贴来促进)?而且,为了这个问题上可能发生的其他人的利益,如果我从头开始写这篇文章,那么实现这个结果的更正确的方法是什么(关于方向改变的新VC)


谢谢。

这是一个非常愚蠢的错误,但如果其他人犯了这个错误并最终来到这里,这就是问题所在

不是正确返回掩码常量,而是:

-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return (UIInterfaceOrientationMaskLandscapeRight);
}
我返回了autocomplete给我的另一个常数:

-(UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return (UIInterfaceOrientationLandscapeRight);
}