다른 ViewController가 포함 된 UIViewController가 있습니다. 초기의 ViewController가있는 viewDidLoad에 설정됩니다컨테이너 뷰 컨트롤러에서 UIPageViewController 회전
FirstViewController *first = [FirstViewController alloc] init];
first.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
first.view.frame = m_content.frame;
[self addChildViewController:first];
[m_content.view addSubview:first.view];
[first didMoveToParentViewController:self];
m_activeViewController = first;
이 컨테이너 컨트롤러는 YES 돌아 automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers을 구현했습니다. 또한 비 액티브 ViewControllers 메뉴 버튼 i가 ViewControllers 간의 전환을 도청
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
for(UIViewController *vc in m_viewControllers)
{
if(vc != [m_activeViewController]
[vc willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
for(UIViewController *vc in m_viewControllers)
{
if(vc != [m_activeViewController]
[vc didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
}
에 정 회전 변화를 수동으로 실시하기 위해 구현되었다.
- (void)onMenuItemTapped:(id)sender
{
UIViewController *vc = [m_viewControllers objectAtIndex:sender.tag];
vc.view.frame = m_content.frame;
[self addChildViewController:vc];
[self transitionFromViewController:m_activeViewController toViewController:vc duration:0 options:UIViewAnimationOptionTransitionNone animations:nil completion:^(BOOL finished) {
[vc didMoveToParentViewController:self];
[m_activeViewController removeFromParentViewController];
m_activeViewController = vc;
}];
}
이 전환은 내 "정상"ViewControllers 잘 동작하고 그들이 활성화되지 않은 경우에도, 방향 변경 후 제대로 표시됩니다. 그러나 SecondCV라는 하위보기 컨트롤러 중 하나는 하위보기 컨트롤러로 UIPageViewController입니다. 나는 UIPageViewControllerDelegate이 SecondCV에 UIPageViewControllerDataSource 세트를 가지고 pageViewController에 : spineLocationForInterfaceOrientation : 나는 풍경 세로 UIPageViewControllerSpineLocationMid에 대한 UIPageViewControllerSpineLocationMin을 반환합니다. 이 SecondVC의 회전 기능은 활성화되어있을 때 올바르게 작동합니다. 가로로 두 페이지가 있고 세로 모드로 한 페이지가 올바르게 표시됩니다. 그러나이 SecondVC가 활성화되어 있지 않으면 회전이 잘못되었습니다. pageViewController : spineLocationForInterfaceOrientation :이 호출 되더라도 세로 및 가로 모드 모두에서 한 페이지가 계속 존재합니다. 나는 이것을 얼마 동안 고치려고 노력하고있다. 그러나 나는 다른 옵션을 보지 못했다. 이 문제를 해결하는 방법에 대한 아이디어가 있습니까?
감사합니다.
페이지 뷰 컨트롤러도 사용하고 있으며 VC에 배열을 추가했지만 다양한 VC의 전환 방법을 알지 못해 어떻게 다음 VC가 페이지 컬 전환을 사용하여 이동할 수 있습니까? 제발 저를 안내하거나 샘플 코드를 게시 할 수 있습니까? –
[link] (https://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html) 여기에 everythink를 찾을 수 있다고 생각합니다. 그렇지 않다면 저에게 연락하십시오. – DaNY
아무 것도 없습니다. 솔루션을 아직 제발 나를 안내 할 수 있다면 제 질문을보십시오. "http://stackoverflow.com/questions/13776894/uipageviewcontroller-change-from-two-page-mode-to-one-page-mode-without-changi#comment18942540_13776894" –