一般UIPageViewController 使用viewControllerBeforeViewController及viewControllerAfterViewController來轉換到上一頁或下一頁,但是若想跳頁的話,怎麼辦?使用transitionFromViewController。
[self transitionFromViewController:pageControllerOld toViewController:pageController duration:0.3 options:UIViewAnimationOptionTransitionCurlDown
animations:^{
//[pageControllerOld.view setAlpha:0.0];
}
completion:^(BOOL finished) {
[pageControllerOld removeFromParentViewController];
[pageController didMoveToParentViewController:self];}
];
從pageControllerOld跳至pageController,
duration是換頁的時間,
options:UIViewAnimationOptionTransitionCurlDown表示向下翻頁。
在completion:時,
將舊的UIPageViewController pageControllerOld去掉removeFromParentViewController。
[pageControllerOld removeFromParentViewController];
放上新的UIPageViewController 。
[pageController didMoveToParentViewController:self];