Objective c iPad横向定位

Objective c iPad横向定位,objective-c,ipad,ios7,landscape-portrait,Objective C,Ipad,Ios7,Landscape Portrait,我正在为iPad创建一个纵向和横向模式的应用程序。我为iPad创建了一个横向模式的XIB,但当我运行该应用程序时,它总是以纵向模式显示。 我将属性列表(.plist)文件下的所有设置设置为“支持的界面方向(iPad)”,设置横向(左主按钮)和横向(右主按钮),并从代码中检查方向,但所有这些都不起作用。 如果任何人知道确切的问题或此问题,请帮助我们,我们正在使用导航控制器在didFinishLaunchingWithOptions in delegate中添加这行代码 [[UIDevice cur

我正在为iPad创建一个纵向和横向模式的应用程序。我为iPad创建了一个横向模式的XIB,但当我运行该应用程序时,它总是以纵向模式显示。 我将属性列表(.plist)文件下的所有设置设置为“支持的界面方向(iPad)”,设置横向(左主按钮)和横向(右主按钮),并从代码中检查方向,但所有这些都不起作用。
如果任何人知道确切的问题或此问题,请帮助我们,我们正在使用导航控制器

在didFinishLaunchingWithOptions in delegate中添加这行代码

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(preferredInterfaceOrientationForPresentation) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
然后首先在delegate中添加以下方法并运行应用程序,如果已修复,则在每个视图控制器中添加以下四个方法。你的问题会解决的

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

- (BOOL)shouldAutorotate {

    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    return UIInterfaceOrientationLandscapeLeft;
}

我已经做了这些,但它不起作用,它仍然只显示纵向模式,Interface Builder中是否有任何设置,我还取消选中Interface Builder中的自动布局复选框在项目设置中启用了哪些设备方向?如果两者都启用,那么这就是应用程序的反应。是的,最初两个方向都启用,现在我设置为仅横向模式,现在模拟器以横向模式显示,但视图中的视图和文本字段仍以纵向显示