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 ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.