Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
APLPageViewControllerDataSource is an array based data source for UIPageViewController.
Objective-C Ruby Shell C C++
Branch: master
Failed to load latest commit information.
APLPageViewControllerDataSourceDemo
Classes/ios Made currentPage and objects to be observable
.gitignore add Pods directory for demo project
APLPageViewControllerDataSource.podspec
CHANGELOG.md
LICENSE add APLPageViewControllerDataSource and demo
README.md
Rakefile Initial commit

README.md

APLPageViewControllerDataSource

Version Platform

APLPageViewControllerDataSource provides an index based API on top of the viewControllerBeforeViewController and viewControllerAfterViewController API of UIPageViewController.

Installation

APLPageViewControllerDataSource is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "APLPageViewControllerDataSource"

Usage

Import header file:

#import "APLPageViewControllerDataSource.h"

Declare a dataSource property:

@property (nonatomic) APLPageViewControllerDataSource *dataSource;

Create a APLPageViewControllerDataSource instance and configure it:

    APLPageViewControllerDataSource *pageViewControllerDataSource = [APLPageViewControllerDataSource new];
    pageViewControllerDataSource.delegate = self;
    pageViewControllerDataSource.pageViewController = pageViewController;
    pageViewControllerDataSource.objects = @[] // your data objects
    self.dataSource = pageViewControllerDataSource;

Declare the protocol methods required to configure the view controller

- (UIViewController*)pageViewControllerDataSource:(APLPageViewControllerDataSource *)dataSource contentViewControllerForIndex:(NSUInteger)index {
    APLContentViewController *detailViewController = [APLContentViewController instantiateFromStoryboard]; // use your own content view controller class
    detailViewController.item = dataSource.objects[index]; // configure your view controller
    return detailViewController;
}

- (NSUInteger)pageViewControllerDataSource:(APLPageViewControllerDataSource *)dataSource indexForContentViewController:(UIViewController *)viewController {
    APLContentViewController *detailViewController = (APLContentViewController*)viewController;
    return [dataSource.objects indexOfObject:detailViewController.item];
}

When you retrieve new data, update your dataSource like this:

self.dataSource.objects = newObjects;

Author

Tobias Conradi, tconradi@apploft.de

License

APLPageViewControllerDataSource is available under the MIT license. See the LICENSE file for more info.

Something went wrong with that request. Please try again.