Coder Social home page Coder Social logo

alexguoq / mapageviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mamaral/mapageviewcontroller

0.0 2.0 0.0 1.17 MB

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

License: MIT License

mapageviewcontroller's Introduction

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.

mapageviewcontroller's People

Watchers

gryphon avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.