Created
February 12, 2015 09:36
-
-
Save jkhowland/b84b4f11aacce5ff4ca1 to your computer and use it in GitHub Desktop.
PresentationViewController viewDidLoad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; | |
self.dataSource = [PageViewControllerDataSource new]; | |
self.pageViewController.dataSource = self.dataSource; | |
[self.pageViewController setViewControllers:@[[self.dataSource initialViewController]] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil]; | |
// We need to add the pageViewController as a childViewController (so that the lifecycle methods get called together. And then we can add the main view of the pageViewController to this viewController's main view. | |
[self addChildViewController:self.pageViewController]; | |
[self.view addSubview:self.pageViewController.view]; | |
[self.pageViewController didMoveToParentViewController:self]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment