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

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)

enter image description here

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.


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
}

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
    }