Preventing the white gap that appears on swiping UIPageViewController

前端 未结 7 1035
广开言路
广开言路 2021-01-06 11:24

I have implemented the UIPageViewController in this manner:

\"Screenshot1\"

GalleryViewController

7条回答
  •  一生所求
    2021-01-06 12:15

    So it appears that the view's frame is not correct before the animation takes place. Try setting up the frame before it starts to come on screen. Something like:

    func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {
    
        var index = (viewController as PageContentViewController).pageIndex!
        if(index <= 0){
            return nil
        }
        index--
    
        // Setting up the new view's frame
        var newVC = self.viewControllerAtIndex(index)
        newVC.view.frame = self.pageViewController.view.bounds
        return newVC
    }
    

提交回复
热议问题