我的故事板上有一个 UIPageViewController,现在我想知道如何向它添加视图控制器?假设我有 5 个视图控制器,如何将它们从头到尾添加到 UIPageViewController?通常我会这样做:
[self addChildViewController:firstViewController];
[self addChildViewController:secondViewController];
[self addChildViewController:thridViewController];
[self addChildViewController:fourthViewController];
[self addChildViewController:fifthViewController];
但我不知道如何按这个顺序在 UIPageViewController 上添加它......
编辑:
ChapterViewController *chapterViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ChapterView"];
NSArray *viewControllers = [NSArray arrayWithObject:chapterViewController];
[self setViewControllers:viewControllers
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:^(BOOL finished){
NSLog(@"call back success");}];