No description, website, or topics provided.
Objective-C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
SMLBookshelfTransitionAnimator
.gitignore
LICENSE
README.md

README.md

SMLBookshelfTransition

A dead simple "bookshelf" UIViewController transition for iOS 7.

Screenshot

Read the original blog post.

Easy Setup

(If you aren't familiar with the new view controller transitioning API, it's best to start here: http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/)

SMLBookshelfTransitionAnimator provides sensible defaults, you really only need to provide it with views for the left and right sides!

SMLBookshelfTransitionAnimator *animator = [[SMLBookshelfTransitionAnimator alloc] init];
animator.leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"left.jpg"]];
animator.rightView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right.jpg"]];

Options

Duration, depth, perspective and rotation direction are all customizable options

Because we often create one off animator instances for presenting and dismissing view controllers, a couple of conveniences for automatically swapping the left and right sides are also provided to help aid in the appearance of a seamless, stateful, 3D transition.

Left, Right, Front, Back

TLDR; Always set the dismissing property when dismissing a view controller.

By default all directional properties of SMLBookshelfTransitionAnimator (leftView, rightView, rotationDirection) are interpreted from the perspective of the front view. The leftView is the side to the left of the front view, the rightView is the side to the right of the front view. When rotating, SMLBookshelfTransitionLeft rotates toward the left -- that is, the left side will push away from the viewer as the right side rotates toward the viewer.

Front is relative! This can be tricky … by default, SMLBookshelfTransitionAnimator is intended to be instantiated once for presenting a view controller and again for dismissing it - this cuts down on the need to maintain a bunch of state across your view controllers just so you can have some pretty animations. Because of this, while setting the dismissing property is optional, it is also highly recommended.

When the dismissing property is set, the leftView and rightView values are swapped. This means that it is then only necessary to think about directionality from the perspective of the presenting view controller. With this approach, a single convenience method can generate SMLBookshelfTransitionAnimator instances with no need to juggle properties based on presentation state; we'll handle the juggling for you.

Take a look at the sample app to see how we're handling this there. I think you'll find the code to be much tidier this way.