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
Even if you will change color of UIPageControl it may not appear. If UIPageController is inside the UITabBarController the TabBar will cover the UIPageControl. The best way to find it is use option Debug->View Debubging->CaptureViewHierarchy. Then in the left bottom filter field type "pageControl". If you click it in the navigator it should locate it on the screen (take a look at the screenshot)
You can change the position like this:
let controlHeight: CGFloat = 50
let bottomSpace: CGFloat = 20
let yPosition = view.frame.size.height - (controlHeight + bottomSpace)
let fullScreenWidth = view.frame.size.width
let frame = CGRect(x: 0, y: yPosition, width: fullScreenWidth, height: controlHeight)
pageControl.frame = frame
Although the answer appears in abundance in many of these answers, I just want to make it explicitly clear that you need to set the UIPageViewController to 'Scroll' before these methods will get hit.
My mistake was to set the count value more than the actual content pages in my page view controller in presentationCount() delegate method.
Why not use swift 3+ version of Zell B.'s answer
func presentationCount(for pageViewController: UIPageViewController) -> Int {
return self.providerItemList?.providerItems?.count ?? 0
}
func presentationIndex(for pageViewController: UIPageViewController) -> Int {
return 0
}
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
}
The dots are white, or semitransparent white. Make sure the background is not white, or change the colour of the dots.