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!
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 UIPageViewController
and forward the view controller changes to your UIPageControl
using setCurrentPage
and setNumberOfPages
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With