Refresh UIPageViewController – reorder pages and add new pages

I found a workaround to force UIPageViewController to forget about cached view controllers of neighboring pages that are currently not displayed:

pageViewController.dataSource = nil;
pageViewController.dataSource = self;

I do this everytime I change the set of pages. Of course this doesn’t affect the currently displayed page.

With this workaround I avoid the caching bug and can still use animated:YES in setViewControllers:direction:animated:completion:.

Leave a Comment