Giter Club home page Giter Club logo

tosplitviewcontroller's Introduction

TOSplitViewController

A split view controller that can display up to three view controllers on the same screen.

Beerpay PayPal

TOSplitViewController is a very 'light' re-implementation of UISplitViewController. It behaves like UISplitViewController for the most part, but is capable of showing up to 3 columns on some of the larger screens such as the 12.9" iPad Pro, or a regular iPad in landscape orientation.

Features

  • Can display 1 to 3 view controllers on screen at the same time depending on the size of the device screen at the time.
  • Handles dynamically collapsing view controllers in separate columns into each other when the screen size changes.
  • Plays an elegant transition animation when device rotations require the number of columns to change.
  • Exposes as much functionality as possible through delegate methods, and UIViewController categories to allow subclasses to override this behaviour.

Code

Due to the way split view controllers work, it's necessary to create all view controllers ahead of time since a split view controller can be presented collapsed, but then expand at a later time:

#import "TOCropViewController.h"

PrimaryViewController *mainController = [[PrimaryViewController alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *primaryNavController = [[UINavigationController alloc] initWithRootViewController:mainController];

SecondaryViewController *secondaryController = [[SecondaryViewController alloc] init];
UINavigationController *secondaryNavController = [[UINavigationController alloc] initWithRootViewController:secondaryController];

DetailViewController *detailController = [[DetailViewController alloc] init];
UINavigationController *detailNavController = [[UINavigationController alloc] initWithRootViewController:detailController];

NSArray *controllers = @[primaryNavController, secondaryNavController, detailNavController];
TOSplitViewController *splitViewController = [[TOSplitViewController alloc] initWithViewControllers:controllers];
splitViewController.delegate = self;

Installation

Manual Installation

Download this repository from GitHub and extract the zip file. In the extracted folder, import the folder name TOSplitViewController into your Xcode project. Make sure 'Copy items if needed` is checked to ensure it is properly copied to your project.

CocoaPods

CocoaPods is a dependency manager that makes it much easier to integrate and subsequently update third party libraries in your app's codebase.

To integrate TOSplitViewController, simply add the following to your podfile:

pod 'TOSplitViewController'

Carthage

Carthage support isn't offered at this time. Please feel free to file a PR. :)

Why Build This?

iPad screen sizes drastically increased with the launch of the 12.9" iPad Pro. Apple took advantage of this by adding 3 column modes to some of iOS' system apps, including Mail and Notes, however this API wasn't made public to third party developers.

I have a design need for a three column display in one of my upcoming projects, and so I decided it would be worth the time and development resources to create this library.

It's still very much in its infancy, and the complexity required to managed 3 columns at once means there may still be plenty of bugs in it, so bug reports (And more importantly pull requests) are warmly welcomed. :)

Credits

TOSplitViewController was developed by Tim Oliver.

iPad Air 2 perspective mockup by Pixeden.

License

TOSplitViewController is available under the MIT license. Please see the LICENSE file for more information. analytics

tosplitviewcontroller's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tosplitviewcontroller's Issues

Storyboards

Is there any chance this will be made storyboard compatible so I won't have to initialize it in AppDelegate programmatically?

Animating column reveal/hiding

There's no clean way to hide/show the primary column, so I've used the following hack:

to_svc.maximumNumberOfColumns = 3
to_svc.viewWillAppear(true)

However, this doesn't animate the column transition. What's the recommended way to achieve this?

Swipe gesture

How about adding a swipe gesture to splitViewController? I tried to imitate ulysses for iPad, but failed. ๐Ÿ˜ข

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.