Objective c 强制UIViewController处于横向模式iOS7

Objective c 强制UIViewController处于横向模式iOS7,objective-c,xcode,uiviewcontroller,orientation,Objective C,Xcode,Uiviewcontroller,Orientation,我已经实现了正确的功能,但它们没有被触发?我在StackOverFlow上尝试了几种解决方案,但都不起作用。我尝试将视图添加到UINavigationController,但也不起作用 FakeIDDetailViewController.h: @interface FakeIDDetailViewController : UIViewController @end FakeIDDetailViewController.m: @interface FakeIDDetailViewControl

我已经实现了正确的功能,但它们没有被触发?我在StackOverFlow上尝试了几种解决方案,但都不起作用。我尝试将视图添加到UINavigationController,但也不起作用

FakeIDDetailViewController.h:

@interface FakeIDDetailViewController : UIViewController
@end
FakeIDDetailViewController.m:

@interface FakeIDDetailViewController ()

-(BOOL)shouldAutorotate
{
    return NO;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (UIInterfaceOrientationMaskLandscapeLeft);
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

- (NSUInteger) application:(UIApplication *)application     supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationLandscapeLeft;
}

如果要将视图控制器推送到导航控制器中的其他视图控制器堆栈中,则只需要横向视图将无法正常工作。您应该以模式显示横向约束视图控制器

有关示例项目,请参见我的回答:

对于导航控制器界面,框架不支持强制定向。请看我的回答:

有关解决方法(不是很好),请参见我的回答:


但是,强制方向对显示的视图控制器很有效。

您尝试过哪些解决方案?正如你所说,有几个。。。可能的重复:可能的重复试试这个:@Jim Clermonts如果其中一个有用的话,你应该接受答案