Stack multiple view controllers that can be moved around. Both Swiping and panning gestures work (only left/right).
JPStackedViewController can have different styles/effects added to it via bitflags. Below is a (hopefully) up to date listing of what is available. You can set style flags like
[stacky setStyle:JPSTYLE_TOUCH_NAV_ONLY | JPSTYLE_COMPRESS_VIEWS];
This is the default (
0) style. Views can be adjusted by tapping and sliding anywhere on them. (shown in the gif below)
Views will only be able to be adjusted when you tap and drag on a UINavigationBar. Note: if you set this style and don't use UINavigationControllers, it will fall back to JPSTYLE_TOUCH_VIEW_ANYWHERE.
Views will "hop" when the far left side is tapped, similar to the iOS camera being accessed from the lock screen.
JPSTYLE_IGNORE_BUTTONS Always enforced now
Gestures will be ignored when the are performed on top of UIButtons.
When views are stacked on the righthand side of the screen, they will be compressed so their their combined visible space will be what one view to the right would be.
JPSTYLE_SNAPS_TO_SIDES Always enforced now
When a view is released, it (and the others) will nap to the left/right side of the screen, depending on what is closer.
If you want to show a specific view (that is loaded in JPStackedViewController), you can do so by calling it's index with
A toggle method has also been added to automatically figure out whether to open/close a view. For example:
will open/close to the UIViewController.
UIViewController *vc = [[UIViewController alloc] init]; [vc.view setBackgroundColor:[UIColor greenColor]]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; UIViewController *vc2 = [[UIViewController alloc] init]; [vc2.view setBackgroundColor:[UIColor redColor]]; UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:vc2]; [nav2.navigationBar setTintColor:[UIColor blackColor]]; UIViewController *vc3 = [[UIViewController alloc] init]; [vc3.view setBackgroundColor:[UIColor yellowColor]]; UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:vc3]; [nav3.navigationBar setTintColor:[UIColor orangeColor]]; UIViewController *vc4 = [[UIViewController alloc] init]; [vc4.view setBackgroundColor:[UIColor blueColor]]; UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:vc4]; [nav4.navigationBar setTintColor:[UIColor greenColor]]; JPStackedViewController *stacky = [[JPStackedViewController alloc] initWithViewControllers:[NSArray arrayWithObjects:nav, nav2, nav3, nav4, nil]]; self.window.rootViewController = stacky;
Comressed & Snap to Side: