Is there any way that I can manipulate the parent view controller so that the subviews will be underneath the UIPageControl?
Asked Answered
P

1

6

I'm implementing horizontal scrolling in an app by making use of an UIPageViewController which I set the navigation property to 'Horizontal' and the Transistion Style to 'scroll'. Everything works fine, I can add some subviews that are presented properly. I also want to make use of the built in UIPageControl that UIPageViewController has by making use of these two methods:

-(NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
-(NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController

This is actually showing what I'm looking for: dots that indicates which subview is shown. But, as you can see in the image, the UIPageControl is set at the bottom of the parent viewcontroller (the UIPageViewController). You can imagine that this is not the way I had in mind to present my UIPageControl. Is there any way that I can manipulate the parent view controller so that the subviews will be underneath the UIPageControl? Or is there any other good practice to achieve this? I know I could implement horizontal scrolling by using a scrollView instead of an UIPageViewController, but this seems much more efficient by me.

http://i48.tinypic.com/2hd03ev.png

For the clarity: The gray part is my subview and the red part is the underlaying UIPageViewController that I'm using.

Thanks in advance for any answer!

Pyrrhic answered 20/2, 2013 at 14:58 Comment(0)
C
4

One solution would be to create and manage your own UIPageControl rather than using the built in one.

If you created your own several options would work to display it at the depth you wanted, but I would recommend creating an overlay a view on top of the UIPageViewController and adding the UIPageControl to that so the two are completely independent. You could also position the page control wherever you wanted.

To track page changes, implement the UIPageViewControllerDelegate of UIPageViewControllerand forward the view controller changes to your UIPageControl using setCurrentPage and setNumberOfPages.

Civilly answered 24/5, 2013 at 5:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.