UIPageViewController - how Can I jump to a particular page number?

前端 未结 5 886
耶瑟儿~
耶瑟儿~ 2020-12-15 20:57

I have spent almost 8 hours finding out how to jump to a particular page number in UIPageViewController... below is what my project looks like

I want to make an app

5条回答
  •  自闭症患者
    2020-12-15 21:36

    Swift Code:

    func goToPage(index: Int) {
        if index < viewControllers.count {
            pageVC!.setViewControllers([viewControllers[index]], direction: .Forward, animated: true, completion: nil)
        }
    }
    

提交回复
热议问题