Access the UIPageControl created by iOS6 UIPageViewController?

I would say, hunt through the subviews. This code successfully finds the UIPageControl in the subviews hierarchy:

NSArray *subviews = pageController.view.subviews;
UIPageControl *thisControl = nil;
for (int i=0; i<[subviews count]; i++) {
    if ([[subviews objectAtIndex:i] isKindOfClass:[UIPageControl class]]) {
        thisControl = (UIPageControl *)[subviews objectAtIndex:i];
    }
}

I'm using this to customize the color of the dots, I imagine you could do the same with the alpha value or send it to the back or something.

Apple provides no direct interface to the UIPageControl through the UIPageViewController class, but there are no illegal method calls required in order to get to it... I don't see why this would result in an app rejection.


In Swift:

    let subviews: Array = self.pageViewController.view.subviews
    var pageControl: UIPageControl! = nil

    for (var i = 0; i < subviews.count; i++) {
        if (subviews[i] is UIPageControl) {
            pageControl = subviews[i] as! UIPageControl
            break
        }
    }

You can access this for all PageControl objects by using appearance (see the UIAppearance protocol), but to get a specific instance you'd have to use recursion. Swift code:

let pageControl = UIPageControl.appearance()