As is typical, I build an array of UIViewControllers and then display them through a UIPageViewController. In my managing controller class, I added a method to go directly to a page. But after doing so, the UIPageViewController shows the wrong adjacent page.
I'm pretty sure that this is because it makes a bad assumption: It starts on a page; and if you push a new controller onto it and say the direction of travel is to the right, UIPageViewController assumes that the previous controller is the one directly to the left.
Of course that fails if you start on page 0 and push the controller for page 2 onto the PageViewController. If you swipe back to the left, you see page 0 again, because UIPageViewController seems to have cached the original view as the one to the left. It never calls its delegate to "get previous view controller" because it thinks it already has it. But it should call and get page 1.
This is my guess, anyway, based on the behavior and the fact that my delegate's "get previous controller" is never called if I swipe left after a jump to the right. So do I have to do a sequence of pushes to get from, say page 0 to page 2?
Anybody have a better workaround or insight? Thanks!