A container UIViewController providing paginated scrolling between configured view controllers. Similar to UIPageViewController, but with added control and feedback.
- Vertical paging support.
- Spacing between view controllers
If you're using CocoPods it's as simple as adding this to your Podfile
:
pod 'GRKPageViewController'
otherwise, simply add GRKPageViewController.h
and GRKPageViewController.m
to your
project.
GRKPageViewController
follows the familiar data source and delegate pattern. To
configure, register your object as the data source and optionally register your object as
the delegate.
Your data source (GRKPageViewControllerDataSource
) must implement:
- (NSUInteger)pageCountForPageViewController:(GRKPageViewController *)controller;
- (UIViewController *)viewControllerForIndex:(NSUInteger)index forPageViewController:(GRKPageViewController *)controller;
to specify the number of pages and provide the corresponding view controller objects.
Optionally your delegate (GRKPageViewControllerDelegate
) can implement either of the
following to get feedback about index changes:
- (void)changedIndexOffset:(CGFloat)indexOffset forPageViewController:(GRKPageViewController *)controller;
- (void)changedIndex:(NSUInteger)index forPageViewController:(GRKPageViewController *)controller;
Additional documentation is available in GRKPageViewController.h
and example usage can
be found in the GRKPageViewControllerTestApp source.
- This work makes use of WWDC 2010 PagingScrollView sample code provided by Apple
- This work is licensed under the Creative Commons Attribution 3.0 Unported License. Please see the included LICENSE.txt for complete details.
A professional iOS engineer by day, my name is Levi Brown. Authoring a technical blog grokin.gs, I am reachable via:
Twitter @levigroker
App.net @levigroker
Email [email protected]
Your constructive comments and feedback are always welcome.