I have a UIPageViewController
that contains multiple view controllers (self is a subclass of UIPageViewController
, and I just put in one view controller here to demonstrate my question):
ViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self setViewControllers:@[viewController] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:nil];
If I put a log in both self and ViewController
class, seems like the viewDidAppear
in ViewController
class gets called BEFORE the viewDidAppear
in UIPageViewController
.
The problem I have is I need to check visibleCells
method in collectionView
that's embedded in ViewController
class. In this scenario, the visible cells method is returning empty array of cells (since it gets called before UIPageViewController
is ready to show). However, everything works fine when I am not using the UIPageViewController
as a container.
I tried addChildViewController
to see if I have any luck but it's not working (obviously). Is there a way in UIPageViewController
that can manage the flow of view cycle?