All Projects → mamaral → Mapageviewcontroller

mamaral / Mapageviewcontroller

Licence: mit
MAPageViewController is a simple wrapper around the most common boiler-plate UIPageViewController setup.

Programming Languages

swift
15916 projects

MAPageViewController

MAPageViewController is a simple wrapper around the most common boiler-plate UIPageViewController setup.

Usage

Simply initilize a MAPageViewController with an array of view controllers, and treat it like any other UIPageViewController, add it as root view controller of your project, wrap it in a navigation controller and present it modally, or do anything else with it that you could do with a view controller.

Swift

let redVC: UIViewController = UIViewController()
redVC.view.backgroundColor = UIColor.redColor()

let blueVC: UIViewController = UIViewController()
blueVC.view.backgroundColor = UIColor.blueColor()

let greenVC: UIViewController = UIViewController()
greenVC.view.backgroundColor = UIColor.greenColor()

let orangeVC: UIViewController = UIViewController()
orangeVC.view.backgroundColor = UIColor.orangeColor()

let brownVC: UIViewController = UIViewController()
brownVC.view.backgroundColor = UIColor.brownColor()

let yellowVC: UIViewController = UIViewController()
yellowVC.view.backgroundColor = UIColor.yellowColor()

let viewControllers: UIViewController[] = [redVC, blueVC, greenVC, orangeVC, brownVC, yellowVC]
self.window!.rootViewController = MAPageViewController(viewControllers: viewControllers)

Objective-C

UIViewController *redVC = [UIViewController new];
redVC.view.backgroundColor = [UIColor redColor];

UIViewController *blueVC = [UIViewController new];
blueVC.view.backgroundColor = [UIColor blueColor];

UIViewController *greenVC = [UIViewController new];
greenVC.view.backgroundColor = [UIColor greenColor];

UIViewController *orangeVC = [UIViewController new];
orangeVC.view.backgroundColor = [UIColor orangeColor];

UIViewController *brownVC = [UIViewController new];
brownVC.view.backgroundColor = [UIColor brownColor];

UIViewController *yellowVC = [UIViewController new];
yellowVC.view.backgroundColor = [UIColor yellowColor];

NSArray *viewControllers = @[redVC, blueVC, greenVC, orangeVC, brownVC, yellowVC];
self.window.rootViewController = [[MAPageViewController alloc] initWithViewControllers:viewControllers];

demo

License

This project is made available under the MIT license. See LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].