Refresh UIPageViewController - reorder pages and add new pages

后端 未结 4 1695
悲&欢浪女
悲&欢浪女 2020-11-30 21:27

I have a UIPageViewController which I am providing page data for using an implementation of UIPageControllerDelegate and UIPageControllerData

4条回答
  •  暖寄归人
    2020-11-30 22:02

    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:.

提交回复
热议问题