# RMPZoomTransitionAnimator [![Version](https://img.shields.io/cocoapods/v/RMPZoomTransitionAnimator.svg?style=flat)](http://cocoapods.org/pods/RMPZoomTransitionAnimator) [![License](https://img.shields.io/cocoapods/l/RMPZoomTransitionAnimator.svg?style=flat)](http://cocoapods.org/pods/RMPZoomTransitionAnimator) [![Platform](https://img.shields.io/cocoapods/p/RMPZoomTransitionAnimator.svg?style=flat)](http://cocoapods.org/pods/RMPZoomTransitionAnimator) ## Overview `RMPZoomTransitionAnimator` provide a custom transition zooming animation. Not only `UICollectionView`, this is possible to use any other `UIViewController` transition. This transition animation is like the "Pinterest" animation, but this is very simple and small library. ![Screen shot](docs/collectionview.gif) ![Screen shot](docs/tableview.gif) ## Installation RMPZoomTransitionAnimator is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby pod "RMPZoomTransitionAnimator" ``` ## Usage To run the example project, clone the repo, and run `pod install` from the Example directory first. Setup is as below: ### Use for an UINavigationController push transition Refer to the example project for details. - Import `RMPZoomTransitionAnimator.h` - Adopt `RMPZoomTransitionAnimating` - Implement the `RMPZoomTransitionAnimating` protocol below, both source view controller and destination view controller 1. `- (UIImageView *)transitionSourceImageView` 2. `- (UIColor *)transitionSourceBackgroundColor` 3. `- (CGRect)transitionDestinationImageViewFrame` - Returns RMPZoomTransitionAnimator instance in the UINavigationController delegate method ```objective-c - (id )navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { // minimum implementation for example RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init]; animator.goingForward = (operation == UINavigationControllerOperationPush); animator.sourceTransition = (id)fromVC; animator.destinationTransition = (id)toVC; return animator; } ``` ### Use for a modal transition Refer to the example project for details. - Import `RMPZoomTransitionAnimator.h` - Adopt `RMPZoomTransitionAnimating` - Implement `RMPZoomTransitionAnimating` protocol below, both source view controller and destination view controller 1. `- (UIImageView *)transitionSourceImageView` 2. `- (UIColor *)transitionSourceBackgroundColor` 3. `- (CGRect)transitionDestinationImageViewFrame` - Set the transitioningDelegate in `prepareForSegue:sender:` - Returns RMPZoomTransitionAnimator instance in the UIViewControllerTransitioningDelegate method ```objective-c - (id)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { // minimum implementation for example RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init]; animator.goingForward = YES; animator.sourceTransition = (id)source; animator.destinationTransition = (id)presented; return animator; } - (id)animationControllerForDismissedController:(UIViewController *)dismissed { // minimum implementation for example RMPZoomTransitionAnimator *animator = [[RMPZoomTransitionAnimator alloc] init]; animator.goingForward = NO; animator.sourceTransition = (id)dismissed; animator.destinationTransition = (id)self; return animator; } ``` ## Requirements - iOS 7.0 or higher ## Change Log ### 1.0.3 - Add option to change default animation duration - Fixed black screen ### 1.0.2 - Remove alpha view and source image view from superview when completed ### 1.0.1 - Adds animation completion handler ### 1.0.0 - First release. ## Contribution If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues. ## Author [Masato Oshima](https://github.com/mpon) Recruit Marketing Partners Co.,Ltd. recruit_mp_oss@ml.cocorou.jp ## License RMPZoomTransitionAnimator is available under the MIT license.