2012-06-25 4 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) 
으로이 작업을 수행
관련 문제