UIInterfaceOrientation景观与Xcode 5中的肖像问题

我觉得我几乎已经在这个话题的每一个职位。 所以,不要把这个问题杀死,直到你阅读。 这个问题是针对iOS 7上的XCode 5的

我有一个支持横向和纵向模式的应用程序。 在我的项目部署信息所有的方向进行检查。

当应用程序启动我显示

  • v1ViewController(总是应该以横向模式打开)

当一个用户点击一个button时,他们会把他们带到

  • v3ViewController(它总是应该以纵向模式打开)

我有的问题是,当应用程序启动,我拿着肖像模式的iPhone显示这一点。

在这里输入图像说明

如果我在横向模式下切换iphone,就会显示出来。

在这里输入图像说明

我如何强制我的v1ViewController始终显示风景模式?

这是我现在的代码。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { return YES; } else { return NO; } } 

但是,如果我添加这个,然后视图总是像我显示的第一张照片打开和旋转没有效果。

 - (BOOL)shouldAutorotate { UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; NSLog(@"interfaceOrientation: %d ...", interfaceOrientation); if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) { return YES; } else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) { return YES; } else { return NO; } } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight; } 

对于任何对我如何工作感兴趣的人,这就是我所做的。

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape(interfaceOrientation); } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; }