我的应用程序能正确地在横屏模式下启动并且工作得很好:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
return NO;
if(interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft )
return YES;
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
并更新了Info.plist文件:
UIInterfaceOrientation = UIInterfaceOrientationLandscapeRight
现在,在我的主控制器中,我将一个视图控制器替换为另一个视图控制器。
characterController = [ [ CharacterController alloc ] init];
myCurrentViewController = characterController;
self.view = myCurrentViewController.view ;
当我加载视图控制器时,它能够正常加载但是方向是纵向模式。如果我旋转iPhone,它会自动调整到横向模式。有没有什么办法在将新的视图控制器加载到我的主控制器中时保持横向方向?