Git Product home page Git Product logo

mbspacialviewcontroller's Introduction

MBSpacialViewController

image

Overview

MBSpacialViewController lets you create an arbitrarily complex map of view controllers in 2D space.

Why would you want to do that? Because it's cool. That's why.

Using gestures, you can navigate up, down, left, and right from any view controller.

A map is automatically generated and displayed in the bottom left corner.

###Demo You can see a live demo in the AppStore in Dicto: https://itunes.apple.com/us/app/dicto/id591603333?mt=8

##Usage
Usage is best explained by checking out the easy to follow sample code. Basically:

  1. Create a master view controller which inherits from MBSpacialMasterViewController.
  2. Set the master's root property to any view controller (must inherit from MBSpacialChildViewController).
  3. Set the root's left/right/upper/lower viewController property. You can do this recursively to create a complex map of view controllers in 2D space: For example:
self.leftViewController = [some subclass of MBSpacialChildViewController];
self.upperViewController = […];
self.upperViewController.leftViewController.lowerViewController = […];

###Navigation Navigating through view controllers is done via gestures, but can also be done programatically: [self moveInDirection:MBDirectionLeft animated:YES]; where self is a subclass of MBSpacialChildViewController

###Modals If you want a view controller to be deallocated and removed from the heirarchy after it disappears, you can make it a modal:

MBSpacialChildViewController *controller = […]
controller.isModal = YES;
controller.modalPresentingViewController = self;
self.rightViewController = controller;
[self moveInDirection:MBDirectionRight animated:YES];

###Gestures By default, navigation is done via 1 finger pan. If you'd like to require 2 fingers (to avoid clash with scroll views and table views), you can do: self.panGesture.minNumberTouchesLeft = 2; This will also update the map to display 2 lines instead of 1 to indicate a two-finger swipe requirement. (Note: Minimal testing was done on this feature)

###View callbacks MBSpacialViewController doesn't use UIKit view callbacks such as viewDidAppear or viewWillAppear. Instead, we use:

-(void)spacialViewDidLoad;
-(void)spacialViewWillAppear;
-(void)spacialViewDidAppear;
-(void)spacialViewWillDisappear;
-(void)spacialViewDidDisappear;

Notes

Any view controller that is part of the view heirarchy must inherit from MBSpacialChildViewController.

##Contact Bitar @bitario

License

MBSpacialViewController is available under the MIT license.

mbspacialviewcontroller's People

Watchers

James Cloos 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.