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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.