Reputation: 9813
I read through the documentation, however I still cannot wrap my head around this one. I have a navigation VC, I set a pageview VC as its root (it doesn't hit my breakpoint in viewdidload in the PageViewController though). All done in storyboard so far.
Do I now create two new viewcontrollers in storyboard and make an array with those two? Where do they get the VCs for this page VC?
Thanks.
Here is some code from the pageviewcontroller: (Nothing happens, just a black screen)
@implementation ResultsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate=self;
self.dataSource=self;
NSMutableArray *array=[[NSMutableArray alloc]init];
[array addObject:[[Page1ViewController alloc]init]];
[array addObject:[[Page2ViewController alloc]init]];
[self setViewControllers:[NSArray arrayWithArray:array] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
// Do any additional setup after loading the view.
}
-(void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL))completion{};
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
Upvotes: 0
Views: 614
Reputation: 2765
To get an idea of how UIPageViewController works using storyboards, you should just create a new project and instead of selecting single view application, just select Page-Based View application and it will automatically connect everything, and from there you can customize further.
Upvotes: 1