在横向模式下制作iOS应用程序

时间:2012-12-23 22:18:22

标签: iphone ios

我有一个针对iOS 5.1的完全空单视图应用程序,我试图让应用程序仅在横向模式下工作。

在项目摘要屏幕中,我选择了两个横向选项,并取消选择了纵向选项。

我在info.plist中验证了只显示横向方向。

在故事板中,我选择了视图控制器转到模拟指标并选择了方向的横向。

当应用程序最初打开时,黑屏将以横向模式显示。显示纯白色视图时,它处于纵向模式。我已阅读了一些帖子,但未能找到解决此问题的方法。

我觉得我忽略了一些简单的东西,但过去当我想在横向模式下制作应用程序时,我只是简单地选择了景观并且它有效。

任何建议都将不胜感激。

@interface ViewController ()

@end

@implementation ViewController



- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

1 个答案:

答案 0 :(得分:1)

您是否在根视图控制器中实现了以下功能?

    - (NSUInteger)supportedInterfaceOrientations
    {
        return UIInterfaceOrientationMaskLandscapeLeft;
    }

http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html