仅使用LandscapeRight进行UINavigation

时间:2012-07-18 06:48:44

标签: ios uinavigationcontroller uiinterfaceorientation

我的应用程序仅支持格局正确。

如果我启动应用程序将iPhone保持在横向状态,则所有连续视图都将以横向模式显示。并且它们不会自动转向任何方向,因为我的应用禁止在所有视图控制器中使用以下代码

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

但是,如果我在纵向模式下启动iPhone的应用程序,我的视图将以纵向模式显示和推送:o(我的视图控制器根本不支持Portait模式)

我的应用程序的第一个视图在UINavigationController上显示为ModalView,然后被解除,并且新的HomeController被推送到堆栈。

如何重新构建我的应用程序,以便导航控制器正确推送视图?

以下是我的didFinishLaunchingWithOptions方法的一些代码

_splashController = [[SplashController alloc] initWithNibName:kViewForSplash bundle:nil];

_navC = [[UINavigationController alloc] init];
_splashController.navC = _navC;
_navC.navigationBarHidden = YES;
[application setStatusBarHidden:YES];

[self.window addSubview:_navC.view];
[_navC presentModalViewController:_splashController animated:YES];

1 个答案:

答案 0 :(得分:0)

尝试设置属性Initial interface orientationSupported interface orientations   到Info.plist中的Landscape (right)

这应该会强制应用程序在横向启动,无论你如何握住它