Changes

An Example iOS 9 UIPageViewController Application

155 bytes added, 19:03, 17 December 2015
no edit summary
The previous chapter entitled [[Implementing a Page based iOS 9 Application using with UIPageViewController]] covered the theory behind implementing page curling view transitions using the UIPageViewController class. This chapter will work through the creation of an application designed to demonstrate this class in action.
== The Xcode Page-based Application Template ==
[[Image:ios_8_page_app_ui.png|The UI layout for an example iOS 9 UIPageViewController app]]
Figure 37-1
</pre>
<google>BUY_IOS9</google>
The application now has a content view controller and a data model from which the content of each page will be extracted by the data source methods. The next logical step, therefore, is to implement those data source methods. As previously outlined in [[Implementing a Page based iOS 9 Application using with UIPageViewController]], instances of the UIPageViewController class need a data source. This takes the form of two methods, one of which is required to return the view controller to be displayed after the currently displayed view controller, and the other the view controller to be displayed before the current view controller. Since the ViewController class is going to act as the data source for the page view controller object, these two methods, together with two convenience methods (which we will borrow from the Xcode Page-based Application template) will need to be added to the ViewController.swift file. Begin by adding the two convenience functions:
<pre>
[[Image:ios_8_page_app_running.png|An example iOS 9 UIPageViewController app running]]
Figure 37-2