O'Reilly logo

The Core iOS Developer’s Cookbook, Fifth Edition by Rich Wardwell, Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a Presentation Index

Page view controllers’ scrolling layouts allow you to add an optional index (utilizing a page control). Any book that uses the scrolling layout style (UIPageViewControllerTransitionStyleScroll) can implement two data source methods. iOS uses them to build the indicator at the bottom of the scrolling book that you saw in Figure 7-5 (right).

As you can see from this snippet, the implementation since its inception is a bit wobbly:

- (NSInteger)presentationIndexForPageViewController:     (UIPageViewController *)pageViewController {     // Slightly borked in iOS 6 & 7     // return [self currentPage];     return 0; } - (NSInteger)presentationCountForPageViewController:     (UIPageViewController ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required