2

아이폰 앱이 항상 세로로 작동합니다.아이폰이 가로 방향으로 바뀌면 풍경에 모달 뷰 컨트롤러가 나타납니다.

이 앱에는 탐색보기 컨트롤러가 있으며 rootViewcontroller도 세로로 표시됩니다. 아이폰이 가로 방향으로 바뀌면 앱을 viewController으로 보이고, 앱이 세로로 돌아 왔을 때이보기 컨트롤러를 닫습니다.

현재 나는이 달성하지만 내 의견은 완전히 이동 :

1 단계 : Step1

2 단계 :

Step2

3 단계 : 나는 몇 가지를 시도 Step3

사물들,하지만 나는 그렇지 않아. 내가 올바른 방법을 선택 해요 알고 :

-(BOOL)shouldAutorotate 
{ 
    return YES; 
} 

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation  duration:(NSTimeInterval)duration 
{ 


} 

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
    if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight) { 
     UIStoryboard *currentStoryboar = [self storyboard]; 
     ASTBigProgressViewController *bigProgress = [currentStoryboar instantiateViewControllerWithIdentifier:@"ASTBigProgressViewController"]; 
     [self presentViewController:bigProgress animated:YES completion:^{ 

     }]; 
    } 
} 
-(NSUInteger)supportedInterfaceOrientations 
{ 
    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | 
      UIInterfaceOrientationMaskLandscapeRight |  UIInterfaceOrientationMaskPortraitUpsideDown); 
} 

내가보기 컨트롤러가 켜져있을 때,이 같은 위치에 그것을 유지하는보기를 설정하지 않습니다 싶습니다. 나는 시도했다 :

-(BOOL)shouldAutorotate 
{ 
    return NO; 
} 

그러나 확실히 didRotateFromInterfaceOrientation 메서드는 호출되지 않았다.

아이디어가 있으십니까?

답변

0

애플 문서가 Creating an Alternate Landscape Interface 일 수 있습니다.

+0

답장을 보내 주셔서 감사 드리며, 더 노력하고 있습니다. 가로 모드 모달보기가 바닥에서보기 대신 오른쪽에 나타나는 문제가 있습니다. – xarly

+0

마지막으로, 저는이 방법을 사용했고 modalTransitionStyle = UIModalTransitionStyleCrossDissolve를 사용하여 오른쪽에서 애니메이션 문제를 수정했습니다. – xarly

0

은 존재하지 마십시오 또는 회전 과정에서 뷰 컨트롤러를 기각,이 ... viewWillRotateRotat 및 viewDidRotate 내에 및 shouldViewRotate 등

당신은 performSelector 사용할 수 있습니다 withDelay합니다. 짧은 지연 0.0 또는 0.01조차도 속임수를 써야합니다.

+0

답변을 주셔서 감사합니다. 제 생각에, 좋은 대답이지만 너무 속임수가 아닌가요? 내 말은, 지연에 의존하는 것이 정확하지 않다는 것입니다. – xarly

+0

오른쪽. 우선 간단한 지연은 현재 진행중인 프로세스를 확실히 분리하고 해산 시키지만 정확하지는 않습니다. 연구를 추가하고 좋은 방법을 찾고 싶을 수도 있습니다. 그러나 지연 0으로 분리해야 할 수도 있습니다. –