The EventsController and Its PageViewController
At the start of this chapter, I promised to show you how to enable users to turn the page between one view controller and another. To implement this cool page-turning stuff, you need a
UIPageViewController. You create that in the
EventsController in its
To start, though, you need to make the
UIPageView Controller data source and delegate. (Actually, in this implementation you won’t need to use any of the delegate methods, but it’s good for you to know about them.) Add the bolded code in Listing 16-11 (which includes the declaration of another method that you’ll use shortly) to
Listing 16-11: Updating the EventsController Interface
@interface EventsController : RTDetailViewController
- (EventPageController *)viewControllerAtIndex:
(NSUInteger)index storyboard:(UIStoryboard *)storyboard;
Now read on to learn about the data source and delegate.
Data sources and delegates
You’ve used delegates a few times already, such as when you add the code to the app delegate in Chapter 8. A data source is really just another kind of delegate that supplies the data that a framework object needs. In Chapter 20, when you implement a dynamic Table view, you do that as well, and data sources are also used in many other places in the framework — in picker ...