2012-06-25 56 views
1
Hi I'm using following code to show my app's login screen. 
LoginViewController * loginController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil]; 
     UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:loginController]; 
     navController.modalPresentationStyle = UIModalPresentationFormSheet; 
     [self.navigationController presentModalViewController:navController animated:YES]; 

它的加载正常。在这里,我的问题是我的应用程序应该只处于横向模式。这里我使用UIModalPresentationFormSheet,所以应用程序自动以纵向模式显示。我想强制我的应用程序在加载此登录视图后更改为横向模式。有些人请帮助我在UIModalPresentationFormSheet加载后如何将视图旋转到横向模式。 (这意味着在LoginViewController的viewDidLoad模式,我必须强迫我的应用程序更改为横向模式,我该如何实现这一点)。在此先感谢如何强制视图旋转到viewdidload中的横向?

回答

0

尝试重新编写您的用户界面框架属性与景观坐标值。

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
             duration:(NSTimeInterval)duration 

和前提

[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; 

if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft 
    || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) 
做到这一点