Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPageViewController with PageControl

I'm using a UIPageViewController to display 4 other ViewControllers. So my RootViewController is a PageViewController which displays 4 other ViewControllers I created in my Storyboard with segues to different Views . All works perfect. But is it possible to add an UIPageControl to this PageViewController. Is this possible anyhow?

Or has someone an idea how I can achieve a similar result?

Would be great, thanks!

like image 859
Daniel Kappacher Avatar asked Mar 28 '13 08:03

Daniel Kappacher


1 Answers

You need to implement these UIPageViewControllerDataSource methods:

Swift

func presentationCount(for pageViewController: UIPageViewController) -> Int { ... }
func presentationIndex(for pageViewController: UIPageViewController) -> Int { ... }

Obj-C

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

And you'll get a page control showing up at the bottom 36px of your UIPageViewController. Try changing the color of the view to a dark color, if you can't see them.

like image 92
yjsoon Avatar answered Oct 07 '22 13:10

yjsoon