2013-10-02 2 views
0

가로 방향 만 지원해야하는 iPad 앱을 개발 중입니다.iOS 컨테이너보기 컨트롤러가 세로 방향으로 어린이보기 추가

- (void) assignFirstChildViewController:(UIViewController*)controller 
{ 
    self.currentChildViewController = controller; 
    [self addChildViewController:self.currentChildViewController]; 
    [self.currentChildViewController didMoveToParentViewController:self]; 
    [self.containerView addSubview:self.currentChildViewController.view]; 

} 
- (void)assignNewChildController:(UIViewController *)childViewController 
{ 
    id currentChildViewController = self.currentChildViewController; 

    if(!currentChildViewController){ 
     [self assignFirstChildViewController:childViewController]; 
    }else{ 

     [self.currentChildViewController willMoveToParentViewController:nil]; 
     [self addChildViewController:childViewController]; 

     __weak __block PTSBaseContainerViewController *weakSelf=self; 
     [self transitionFromViewController:self.currentChildViewController 
          toViewController:childViewController 
            duration:1.0 
            options:0 
           animations:^{ 
            [UIView transitionFromView:self.currentChildViewController.view toView:childViewController.view duration:1.0 options:UIViewAnimationOptionTransitionCrossDissolve completion:NULL]; 
           } 
           completion:^(BOOL finished) { 
            [weakSelf.currentChildViewController removeFromParentViewController]; 
            weakSelf.currentChildViewController = childViewController; 
            [weakSelf.currentChildViewController didMoveToParentViewController:weakSelf]; 
           }]; 


    } 
} 
문제는 아이 뷰 컨트롤러의 뷰가 세로 방향으로 추가되었는지와의 의견을 망쳐 놨

와 같이 내 컨테이너 뷰 컨트롤러에 새로운 아이 뷰 컨트롤러를 추가하려면 다음 두 가지 방법을 사용 다음 이미지 :

enter image description here

녹색보기는 세로 모드에 추가됩니다 볼 수있는 아이 뷰 컨트롤러의보기입니다. 노란색보기 전체 (컨테이너보기이며 회색 위쪽 막대 아래에있는보기 컨트롤러의 전체 프레임을 차지함)를 차지하는 대신 세로보기 모드로 추가되므로 그 이유를 알 수 없습니다.

PS : 사과 설명서에 쓰여 있듯이 shouldAutomaticallyForwardRotationMethodsshouldAutomaticallyForwardAppearanceMethods을 무시했지만 결과가 없습니다.

답변

1

Apple's documentation에서 볼 수 있듯이 수동으로 하위보기 컨트롤러의 프레임을 설정해야합니다.

관련 문제