Create a gesture-driven map of view controllers in 2D space.
Latest commit e983983 Jun 13, 2013 Bitar Update
Failed to load latest commit information.
MBSpacialViewController readme Mar 5, 2013
SpacialDemo schemes Mar 31, 2013
LICENSE license Mar 4, 2013 Update Jun 13, 2013




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.


You can see a live demo in the AppStore in Dicto:


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 = […];


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


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];


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:



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


Bitar @bitario


MBSpacialViewController is available under the MIT license.