2010-08-09 3 views
0

먼저 - 비슷한 주제를 모두 읽었고 그 중 일부는 나를 위해 작동하지 않습니다. 뷰 컨트롤러가 거의 없습니다. 그리고 그 코드를 변경 : iPhone force orientation

- (void)flipToAzbukaMenu { 
    AzbukaMenuController *aAzbukaMenu = [[AzbukaMenuController alloc] initWithNibName:@"AzbukaMenu" bundle:nil]; 
    [self setAzbukaMenuController:aAzbukaMenu]; 
    [aAzbukaMenu release]; 

    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:2.0]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO]; 
    [viewController.view removeFromSuperview]; 
    [azbukaArcadeController.view removeFromSuperview]; 
    [self.window addSubview:[azbukaMenuController view]]; 

    [UIView commitAnimations]; 
} 

이 또한 내가 나 가로 모드에서 응용 프로그램을 시작할 수 있습니다 PLIST에 적절한 키가 있습니다. 앱이 시작되면 앱이 올바른 방향 (가로)을 가졌지 만 내보기를 변경하면 세로가되고 270도 회전하지 않고 다시 가로로 바뀝니다 (90LOL 아님). 앱이 모든보기를 가로 모드로 표시하도록하려면 어떻게해야합니까?

UPD :

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    if ((interfaceOrientation==UIInterfaceOrientationPortrait)||(interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)) 
    { 
     return NO; 
    } 
    if ((interfaceOrientation==UIInterfaceOrientationLandscapeLeft)||(interfaceOrientation==UIInterfaceOrientationLandscapeRight)) 
    { 
     return YES; 
    } else { 
     return YES; 
    } 
} 

답변

0

두 가지 풍경 모드와 두 개의 세로 모드가 있습니다. 하나는 풍경 왼쪽, 다른 하나는 풍경 오른쪽입니다. 예를 들어 풍경 모드에서 세로 모드 중 하나 (예 : 하단의 홈 버튼 사용)로 돌아 가면 270도 회전을 얻게됩니다. 이것은 항상 뷰가 가로 왼쪽 방향으로 표시되게합니다

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

: (두 가지 모드 중 하나를 선택) 가로를 유지하기 위해 귀하의 의견을 강제하는 방법에 관해서는

, 그냥 그런 짓을.

+0

수정 - UPD의 코드에서만 작동합니다. – Andoriyu