Pergunta

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!

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top