Refresh UIPageViewController - reorder pages and add new pages

后端 未结 4 1702
悲&欢浪女
悲&欢浪女 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:07

    Here's my complete implementation of @ortwin-gentz's answer in the didFinish delegate method in Swift 2, which works perfectly for me:

    func pageViewController(
        pageViewController: UIPageViewController,
        didFinishAnimating finished: Bool,
        previousViewControllers: [UIViewController],
        transitionCompleted completed: Bool
    ) {
        if !completed { return }
        dispatch_async(dispatch_get_main_queue()) {
            pageViewController.dataSource = nil
            pageViewController.dataSource = self
        }
    }
    

提交回复
热议问题