Git Product home page Git Product logo

mspageviewcontroller's Introduction

MSPageViewController

Description:

Did you ever want to implement a simple UIPageViewController and realized that you had to do it all by code? With MSPageViewController you will be able to design each page from a single storyboard!

Example Storyboard

How to Use:

First you must create a subclass of MSPageViewController and override -pageIdentifiers. Example:

- (NSArray *)pageIdentifiers {
	return @[@"page1", @"page2"];
}

Then you have to create a storyboard, add a UIPageViewController object and change its class to MSPageViewController. Then you can add the controllers, setting their Storyboard IDs to what you returned in pageIdentifiers. Each of them must be a class that conforms to MSPageViewControllerChild (if you don't need to add any extra functionality to it you can use MSPageViewControllerPage).

When your controller is instantiated, it will use these controllers to create each page.

Make sure you also check out the sample project in this repo.

Alternate use:

If you need all your pages to look the same, but providing different data, you can create a single page in the storyboard and return it as many times as you need:

- (NSArray *)pageIdentifiers {
	return @[@"page1", @"page1", @"page1"];
}

Then in your MSPageViewController subclass you can override this method to configure each page:

- (void)setUpViewController:(MyCustomControllerPage *)page
                    atIndex:(NSInteger)index  {
	[super setUpViewController:page atIndex:index];

	page.customData = [self dataForPageAtIndex:index];
}

Instalation:

Just add this line to your Podfile:

pod 'MSPageViewController', '~> 1.0.0'
  • Manually:

Simply add the files under Source to your project.

Compatibility

  • Requires ARC. If you want to use it in a project without ARC, mark the implementation files with the linker flag -fobjc-arc.
  • Supports iOS iOS6+.

License

MSPageViewController is available under the WTFPL license. See the LICENSE file for more info.

mspageviewcontroller's People

Contributors

nachosoto avatar

Watchers

 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.