Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Inferis/ViewDeck
Browse files Browse the repository at this point in the history
Conflicts:
	ViewDeck/IIViewDeckController.m
  • Loading branch information
Barum Rho committed Feb 4, 2012
2 parents 47ccf26 + a086ce1 commit 9d90190
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 133 deletions.
34 changes: 29 additions & 5 deletions README.md
Expand Up @@ -7,15 +7,18 @@ The ViewDeckController supports both a left and a right sideview (in any combina

The class is built so that it augments current navigation technologies found in IOS.

The controller supports rotation, too.

# Requirements

The library supports both ARC and non-ARC projects (the ARC mode is detected automagically, and the code is modified where necessary according to the ARC mode in use).

# Demo
# Demo video & Screenshots

You're probably curious how it looks. Here's some shots from the example app:

![Left opened](http://cl.ly/063X412a1i2U2e3f3D02/Image%202012.01.26%2023:26:55.png) ![Right opened](http://cl.ly/381S0i1c2c1Z2l2U3303/Image%202012.01.26%2023:29:31.png)

See: http://vimeo.com/34538429
See the controller in action: http://vimeo.com/34538429 (general demo) and http://vimeo.com/35716738 (elasticity).
These are demos of the included `ViewDeckExample` app.

# Installation

Expand Down Expand Up @@ -71,7 +74,28 @@ The controller also allows you to close the side views with a bouncing animation

## shadow

The center controller view receives a shadow to give it an *on-top* appearance. There's currently no wait to customize this directly without editing the code.
The center controller view receives a shadow to give it an *on-top* appearance. The shadow is defined by the view deck controller.
You can override the shadow (or leave it out alltogether) by assigning a delegate that implements the `viewDeckController:applyShadow:withBounds:` selector. You'll be passed the layer of the view on which the shadow should be set. If you override said selector, setting the shadow is up to you, and the view deck controller will not apply any shadow itself.

For example:

// applies a small, red shadow
- (void)viewDeckController:(IIViewDeckController *)viewDeckController applyShadow:(CALayer *)shadowLayer withBounds:(CGRect)rect {
shadowLayer.masksToBounds = NO;
shadowLayer.shadowRadius = 5;
shadowLayer.shadowOpacity = 0.9;
shadowLayer.shadowColor = [[UIColor redColor] CGColor];
shadowLayer.shadowOffset = CGSizeZero;
shadowLayer.shadowPath = [[UIBezierPath bezierPathWithRect:rect] CGPath];
}

The bounds passed in through `rect` can be used for setting the shadow path to the layer, for performance reasons. It will be set to the bounds of the center view.

## elasticity

The controller supports "elasticity": when you pan the center view "over" one of the ledges, you'll see that it gets pulled a bit further, but you can't pull it all the way to the edge. When you let go, it jumps back to the set ledge size. This gives the controller behavior are a more lifelike feel.

Of course, you can turn this behavior off. Just set `elasticity = NO` when loading the controller and you're set.

## rotation

Expand Down
3 changes: 3 additions & 0 deletions ViewDeck/IIViewDeckController.h
Expand Up @@ -72,6 +72,7 @@ typedef enum {
@property (nonatomic, retain) UIView* panningView;
@property (nonatomic, readonly, retain) NSArray* controllers;
@property (nonatomic, getter=isEnabled) BOOL enabled;
@property (nonatomic) BOOL elastic;

@property (nonatomic) CGFloat leftLedge;
@property (nonatomic) CGFloat rightLedge;
Expand Down Expand Up @@ -122,6 +123,8 @@ typedef enum {
@protocol IIViewDeckControllerDelegate <NSObject>

@optional
- (void)viewDeckController:(IIViewDeckController*)viewDeckController applyShadow:(CALayer*)shadowLayer withBounds:(CGRect)rect;

- (void)viewDeckController:(IIViewDeckController*)viewDeckController didPanToOffset:(CGFloat)offset;
- (void)viewDeckController:(IIViewDeckController *)viewDeckController didBounceWithClosingController:(UIViewController*)openController;
- (BOOL)viewDeckControllerWillOpenLeftView:(IIViewDeckController*)viewDeckController animated:(BOOL)animated;
Expand Down

0 comments on commit 9d90190

Please sign in to comment.