Swift/iOS8: Why are Page Control indicators not showing?

后端 未结 6 2335
暗喜
暗喜 2021-02-19 08:54

I am implementing a straightforward gallery view controller where the app displays a small range of full-screen images that the user can scroll through. I\'m using UIPageViewCon

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 09:17

    Taken from here :

    In order to show UIPageControl, you need to implement two optional datasource methods. Just return the whole number of pages for presentationCountForPageViewController and the initially selected index for presentationIndexForPageViewController

    func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int {
        return pageContent.count
    }
    
    func presentationIndexForPageViewController(pageViewController: UIPageViewController) -> Int {
        return 0
    }
    

提交回复
热议问题