Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyro2927/jpstackedviewcontroller
Allows multiple stacked view controllers to be slid around
https://github.com/pyro2927/jpstackedviewcontroller
Last synced: about 17 hours ago
JSON representation
Allows multiple stacked view controllers to be slid around
- Host: GitHub
- URL: https://github.com/pyro2927/jpstackedviewcontroller
- Owner: pyro2927
- Created: 2012-11-23T21:02:15.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-05T18:32:29.000Z (over 11 years ago)
- Last Synced: 2023-04-12T16:22:19.390Z (over 1 year ago)
- Language: Objective-C
- Size: 457 KB
- Stars: 23
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JPStackedViewController
Stack multiple view controllers that can be moved around. Both Swiping and panning gestures work (only left/right).## Customizing/Styling
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];
##### JPSTYLE_TOUCH_VIEW_ANYWHERE
This is the default (`0`) style. Views can be adjusted by tapping and sliding anywhere on them. (shown in the gif below)##### JPSTYLE_TOUCH_NAV_ONLY
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.**##### ~~JPSTYLE_VIEW_HOP~~ *Deprecated*
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.##### JPSTYLE_COMPRESS_VIEWS
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.## Presenting Views
If you want to show a specific view (that is loaded in JPStackedViewController), you can do so by calling it's index with[stacky openToIndex:1];
A toggle method has also been added to automatically figure out whether to open/close a view. For example:[stacky toggleViewAtIndex:0];
will open/close to the UIViewController.## Example Code
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;## Pictures
In action:![](https://raw.github.com/pyro2927/JPStackedViewController/master/stacked.gif)
Compressed:
![](https://raw.github.com/pyro2927/JPStackedViewController/master/compressed.png)
Comressed & Snap to Side:
![](https://raw.github.com/pyro2927/JPStackedViewController/master/styles.gif)