├── .gitignore ├── LICENSE ├── README.md ├── YSLTransitionAnimator.podspec ├── YSLTransitionAnimator ├── Resources │ └── ysl_navi_back_btn@2x.png ├── UIViewController+YSLTransition.h ├── UIViewController+YSLTransition.m ├── YSLTransitionAnimator.h └── YSLTransitionAnimator.m ├── YSLTransitionAnimatorDemo.xcodeproj └── project.pbxproj ├── YSLTransitionAnimatorDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CollectionCell.h ├── CollectionCell.m ├── CollectionCell.xib ├── CollectionDetailViewController.h ├── CollectionDetailViewController.m ├── CollectionDetailViewController.xib ├── CollectionViewController.h ├── CollectionViewController.m ├── CollectionViewController.xib ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Resources │ ├── photo_sample_01.png │ ├── photo_sample_02.png │ ├── photo_sample_03.png │ ├── photo_sample_04.png │ ├── photo_sample_05.png │ ├── photo_sample_06.png │ └── photo_sample_07.png ├── SelectTableViewController.h ├── SelectTableViewController.m ├── TableCell.h ├── TableCell.m ├── TableCell.xib ├── TableDetailViewController.h ├── TableDetailViewController.m ├── TableDetailViewController.xib ├── TableDetailViewController2.h ├── TableDetailViewController2.m ├── TableDetailViewController2.xib ├── TableViewController.h ├── TableViewController.m ├── TableViewController.xib └── main.m ├── YSLTransitionAnimatorDemoTests ├── Info.plist └── YSLTransitionAnimatorDemoTests.m ├── sample_01.gif └── sample_02.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 y-hryk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YSLTransitionAnimator 2 | 3 | ## Demo 4 | ![Dome](https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/master/sample_01.gif) 5 | ![Dome](https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/master/sample_02.gif) 6 | ## Requirement 7 | not support landscape 8 | 9 | iOS 7.0 10 | ## Install 11 | #### Manually 12 | Copy YSLTransitionAnimator directory to your project. 13 | #### CocoaPods 14 | Add pod 'YSLTransitionAnimator' to your Podfile. 15 | 16 | ## Usage 17 | - import `YSLTransitionAnimator.h` 18 | - import `UIViewController+YSLTransition.h` 19 | 20 | ### Push Transition 21 | ``` objective-c 22 | @interface ViewController () 23 | 24 | - (void)viewWillDisappear:(BOOL)animated 25 | { 26 | [self ysl_removeTransitionDelegate]; 27 | } 28 | 29 | - (void)viewDidAppear:(BOOL)animated 30 | { 31 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 32 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 33 | 34 | [self ysl_addTransitionDelegate:self]; 35 | [self ysl_pushTransitionAnimationWithToViewControllerImagePointY:statusHeight + navigationHeight 36 | animationDuration:0.3]; 37 | } 38 | 39 | #pragma mark -- YSLTransitionAnimatorDataSource 40 | - (UIImageView *)pushTransitionImageView 41 | { 42 | CollectionCell *cell = (CollectionCell *)[self.collectionView cellForItemAtIndexPath:[[self.collectionView indexPathsForSelectedItems] firstObject]]; 43 | return cell.itemImage; 44 | } 45 | 46 | - (UIImageView *)popTransitionImageView 47 | { 48 | return nil; 49 | } 50 | 51 | ``` 52 | ### Pop Transition 53 | ``` objective-c 54 | @interface ViewController () 55 | 56 | - (void)viewWillDisappear:(BOOL)animated 57 | { 58 | [self ysl_removeTransitionDelegate]; 59 | } 60 | 61 | - (void)viewDidAppear:(BOOL)animated 62 | { 63 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 64 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 65 | [self ysl_addTransitionDelegate:self]; 66 | [self ysl_popTransitionAnimationWithCurrentScrollView:self.tableView 67 | cancelAnimationPointY:self.headerImageView.frame.size.height - (statusHeight + navigationHeight) 68 | animationDuration:0.3 69 | isInteractiveTransition:YES]; 70 | } 71 | 72 | #pragma mark -- YSLTransitionAnimatorDataSource 73 | 74 | - (UIImageView *)pushTransitionImageView 75 | { 76 | return nil; 77 | } 78 | 79 | - (UIImageView *)popTransitionImageView 80 | { 81 | return self.headerImageView; 82 | } 83 | ``` 84 | ## Licence 85 | MIT 86 | 87 | -------------------------------------------------------------------------------- /YSLTransitionAnimator.podspec: -------------------------------------------------------------------------------- 1 | @version = "0.0.2" 2 | Pod::Spec.new do |s| 3 | s.name = "YSLTransitionAnimator" 4 | s.version = @version 5 | s.summary = "a pinterest style transition animation" 6 | s.homepage = "https://github.com/y-hryk/YSLTransitionAnimator" 7 | s.license = { :type => 'MIT', :file => 'LICENSE' } 8 | s.author = { "y-hryk" => "dev.hy630823@gmail.com" } 9 | s.source = { :git => "https://github.com/y-hryk/YSLTransitionAnimator.git", :tag => @version } 10 | s.source_files = 'YSLTransitionAnimator/**/*.{h,m}' 11 | s.resources = 'YSLTransitionAnimator/Resources/*.png' 12 | s.requires_arc = true 13 | s.ios.deployment_target = '7.0' 14 | end -------------------------------------------------------------------------------- /YSLTransitionAnimator/Resources/ysl_navi_back_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimator/Resources/ysl_navi_back_btn@2x.png -------------------------------------------------------------------------------- /YSLTransitionAnimator/UIViewController+YSLTransition.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+YSLTransition.h 3 | // CustomTransition_Sample 4 | // 5 | // Created by yamaguchi on 2015/04/16. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YSLTransitionAnimator.h" 11 | 12 | @interface UIViewController (YSLTransition) 13 | 14 | @property (nonatomic, strong) UIPercentDrivenInteractiveTransition *interactivePopTransition; 15 | @property (nonatomic, strong) UIScrollView *scrollView; 16 | @property (nonatomic, strong) NSNumber *toViewControllerImagePointY; 17 | @property (nonatomic, strong) NSNumber *cancelAnimationPointY; 18 | @property (nonatomic, strong) NSNumber *animationDuration; 19 | 20 | 21 | - (void)ysl_pushTransitionAnimationWithToViewControllerImagePointY:(CGFloat)toViewControllerImagePointY 22 | animationDuration:(CGFloat)animationDuration; 23 | 24 | - (void)ysl_popTransitionAnimationWithCurrentScrollView:(UIScrollView*)scrollView 25 | cancelAnimationPointY:(CGFloat)cancelAnimationPointY 26 | animationDuration:(CGFloat)animationDuration 27 | isInteractiveTransition:(BOOL)isInteractiveTransition; 28 | 29 | 30 | - (void)ysl_addTransitionDelegate:(UIViewController*)viewController; 31 | - (void)ysl_removeTransitionDelegate; 32 | 33 | - (void)ysl_setUpReturnBtnWithColor:(UIColor *)color callBackHandler:(void (^)())callBackHandler; 34 | - (void)ysl_setupReturnBtnWithImage:(UIImage *)image color:(UIColor *)color callBackHandler:(void (^)())callBackHandler; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /YSLTransitionAnimator/UIViewController+YSLTransition.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+YSLTransition.m 3 | // CustomTransition_Sample 4 | // 5 | // Created by yamaguchi on 2015/04/16. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+YSLTransition.h" 10 | #import 11 | 12 | static BOOL isScrollView = NO; 13 | 14 | @implementation UIViewController (YSLTransition) 15 | 16 | - (UIPercentDrivenInteractiveTransition *)interactivePopTransition 17 | { 18 | return objc_getAssociatedObject(self, @selector(interactivePopTransition)); 19 | } 20 | 21 | - (void)setInteractivePopTransition:(UIPercentDrivenInteractiveTransition *)interactivePopTransition 22 | { 23 | objc_setAssociatedObject(self, @selector(interactivePopTransition), interactivePopTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 24 | } 25 | 26 | - (UIScrollView *)scrollView 27 | { 28 | return objc_getAssociatedObject(self, @selector(scrollView)); 29 | } 30 | 31 | - (void)setScrollView:(UIScrollView *)scrollView 32 | { 33 | objc_setAssociatedObject(self, @selector(scrollView), scrollView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 34 | } 35 | 36 | - (NSNumber *)toViewControllerImagePointY 37 | { 38 | NSNumber *value = objc_getAssociatedObject(self, @selector(toViewControllerImagePointY)); 39 | return value; 40 | } 41 | 42 | - (void)setToViewControllerImagePointY:(NSNumber *)toViewControllerImagePointY 43 | { 44 | objc_setAssociatedObject(self, @selector(toViewControllerImagePointY), toViewControllerImagePointY, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 45 | } 46 | 47 | - (NSNumber *)cancelAnimationPointY 48 | { 49 | NSNumber *value = objc_getAssociatedObject(self, @selector(cancelAnimationPointY)); 50 | return value; 51 | } 52 | 53 | - (void)setCancelAnimationPointY:(NSNumber *)cancelAnimationPointY 54 | { 55 | objc_setAssociatedObject(self, @selector(cancelAnimationPointY), cancelAnimationPointY, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 56 | } 57 | 58 | - (NSNumber *)animationDuration 59 | { 60 | NSNumber *value = objc_getAssociatedObject(self, @selector(animationDuration)); 61 | return value; 62 | } 63 | 64 | - (void)setAnimationDuration:(NSNumber *)animationDuration 65 | { 66 | objc_setAssociatedObject(self, @selector(animationDuration), animationDuration, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 67 | } 68 | 69 | #pragma mark -- Public 70 | 71 | - (void)ysl_setUpReturnBtnWithColor:(UIColor *)color callBackHandler:(void (^)())callBackHandler 72 | { 73 | objc_setAssociatedObject(self, (__bridge void *)(@"ysl_return_Action"), callBackHandler, OBJC_ASSOCIATION_COPY_NONATOMIC); 74 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"ysl_navi_back_btn.png"] 75 | style:UIBarButtonItemStylePlain 76 | target:self 77 | action:@selector(returnAction:)]; 78 | if (color) { 79 | self.navigationItem.leftBarButtonItem.tintColor = color; 80 | } else { 81 | self.navigationItem.leftBarButtonItem.tintColor = [UIColor lightGrayColor]; 82 | } 83 | } 84 | 85 | - (void)ysl_setupReturnBtnWithImage:(UIImage *)image color:(UIColor *)color callBackHandler:(void (^)())callBackHandler 86 | { 87 | objc_setAssociatedObject(self, (__bridge void *)(@"ysl_return_Action"), callBackHandler, OBJC_ASSOCIATION_COPY_NONATOMIC); 88 | 89 | UIImage *btnImage = [UIImage imageNamed:@"ysl_navi_back_btn.png"]; 90 | if (image) { 91 | btnImage = image; 92 | } 93 | 94 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:btnImage 95 | style:UIBarButtonItemStylePlain 96 | target:self 97 | action:@selector(returnAction:)]; 98 | if (color) { 99 | self.navigationItem.leftBarButtonItem.tintColor = color; 100 | } else { 101 | self.navigationItem.leftBarButtonItem.tintColor = [UIColor lightGrayColor]; 102 | } 103 | } 104 | 105 | #pragma mark -- private 106 | - (void)returnAction:(id)sender 107 | { 108 | void (^callBackHandler)() = objc_getAssociatedObject(self, (__bridge void *)(@"ysl_return_Action")); 109 | if(callBackHandler){ 110 | callBackHandler(); 111 | } 112 | } 113 | 114 | #pragma mark -- public 115 | 116 | - (void)ysl_pushTransitionAnimationWithToViewControllerImagePointY:(CGFloat)toViewControllerImagePointY 117 | animationDuration:(CGFloat)animationDuration 118 | { 119 | self.toViewControllerImagePointY = @(toViewControllerImagePointY); 120 | self.animationDuration = @(animationDuration); 121 | } 122 | 123 | - (void)ysl_popTransitionAnimationWithCurrentScrollView:(UIScrollView*)scrollView 124 | cancelAnimationPointY:(CGFloat)cancelAnimationPointY 125 | animationDuration:(CGFloat)animationDuration 126 | isInteractiveTransition:(BOOL)isInteractiveTransition 127 | { 128 | if (scrollView) { 129 | self.scrollView = scrollView; 130 | isScrollView = YES; 131 | } 132 | self.cancelAnimationPointY = @(cancelAnimationPointY); 133 | self.animationDuration = @(animationDuration); 134 | 135 | if (isInteractiveTransition) { 136 | UIScreenEdgePanGestureRecognizer *popRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePopRecognizer:)]; 137 | popRecognizer.edges = UIRectEdgeLeft; 138 | [self.view addGestureRecognizer:popRecognizer]; 139 | } 140 | } 141 | 142 | - (void)ysl_addTransitionDelegate:(UIViewController*)viewController 143 | { 144 | self.navigationController.delegate = self; 145 | 146 | if ([viewController isKindOfClass:[UITableViewController class]]) { 147 | UITableViewController *vc = (UITableViewController *)viewController; 148 | vc.clearsSelectionOnViewWillAppear = NO; 149 | } 150 | 151 | if ([viewController isKindOfClass:[UICollectionViewController class]]) { 152 | UICollectionViewController *vc = (UICollectionViewController *)viewController; 153 | vc.clearsSelectionOnViewWillAppear = NO; 154 | } 155 | } 156 | 157 | - (void)ysl_removeTransitionDelegate 158 | { 159 | if (self.navigationController.delegate == self) { 160 | self.navigationController.delegate = nil; 161 | } 162 | } 163 | 164 | #pragma mark -- NavitionContollerDelegate 165 | - (id)navigationController:(UINavigationController *)navigationController 166 | interactionControllerForAnimationController:(id)animationController 167 | { 168 | if (!self.interactivePopTransition) { return nil; } 169 | return self.interactivePopTransition; 170 | } 171 | 172 | - (id)navigationController:(UINavigationController *)navigationController 173 | animationControllerForOperation:(UINavigationControllerOperation)operation 174 | fromViewController:(UIViewController *)fromVC 175 | toViewController:(UIViewController *)toVC 176 | { 177 | 178 | if ([(id)fromVC conformsToProtocol:@protocol(YSLTransitionAnimatorDataSource)] && 179 | [(id)toVC conformsToProtocol:@protocol(YSLTransitionAnimatorDataSource)]) { 180 | 181 | if (operation == UINavigationControllerOperationPush) { 182 | 183 | if (operation != UINavigationControllerOperationPush) { return nil; } 184 | YSLTransitionAnimator *animator = [[YSLTransitionAnimator alloc]init]; 185 | animator.isForward = (operation == UINavigationControllerOperationPush); 186 | 187 | animator.toViewControllerImagePointY = [self.toViewControllerImagePointY floatValue]; 188 | animator.animationDuration = [self.animationDuration floatValue]; 189 | return animator; 190 | 191 | } else if (operation == UINavigationControllerOperationPop) { 192 | 193 | if (operation != UINavigationControllerOperationPop) { return nil; } 194 | 195 | if (isScrollView && self.cancelAnimationPointY != 0) { 196 | if (self.scrollView.contentOffset.y > [self.cancelAnimationPointY floatValue]) { return nil; } 197 | } 198 | 199 | YSLTransitionAnimator *animator = [[YSLTransitionAnimator alloc]init]; 200 | animator.isForward = (operation == UINavigationControllerOperationPush); 201 | animator.animationDuration = [self.animationDuration floatValue]; 202 | return animator; 203 | 204 | } else { 205 | return nil; 206 | } 207 | } else { 208 | return nil; 209 | } 210 | } 211 | 212 | #pragma mark UIGestureRecognizer handlers 213 | 214 | - (void)handlePopRecognizer:(UIScreenEdgePanGestureRecognizer*)recognizer 215 | { 216 | CGFloat progress = [recognizer translationInView:self.view].x / (self.view.bounds.size.width); 217 | progress = MIN(1.0, MAX(0.0, progress)); 218 | 219 | if (recognizer.state == UIGestureRecognizerStateBegan) { 220 | self.interactivePopTransition = [[UIPercentDrivenInteractiveTransition alloc] init]; 221 | [self.navigationController popViewControllerAnimated:YES]; 222 | } 223 | else if (recognizer.state == UIGestureRecognizerStateChanged) { 224 | [self.interactivePopTransition updateInteractiveTransition:progress]; 225 | } 226 | else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) { 227 | if (progress > 0.5) { 228 | [self.interactivePopTransition finishInteractiveTransition]; 229 | } 230 | else { 231 | [self.interactivePopTransition cancelInteractiveTransition]; 232 | } 233 | self.interactivePopTransition = nil; 234 | } 235 | } 236 | 237 | @end 238 | -------------------------------------------------------------------------------- /YSLTransitionAnimator/YSLTransitionAnimator.h: -------------------------------------------------------------------------------- 1 | // 2 | // YSLTransitionAnimator.h 3 | // CustomTransition_Sample 4 | // 5 | // Created by yamaguchi on 2015/04/16. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @protocol YSLTransitionAnimatorDataSource 13 | 14 | - (UIImageView *)pushTransitionImageView; 15 | - (UIImageView *)popTransitionImageView; 16 | 17 | @end 18 | 19 | @interface YSLTransitionAnimator : NSObject 20 | 21 | @property (nonatomic, assign) BOOL isForward; 22 | @property (nonatomic, assign) NSTimeInterval animationDuration; 23 | @property (nonatomic, assign) CGFloat toViewControllerImagePointY; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YSLTransitionAnimator/YSLTransitionAnimator.m: -------------------------------------------------------------------------------- 1 | // 2 | // YSLTransitionAnimator.m 3 | // CustomTransition_Sample 4 | // 5 | // Created by yamaguchi on 2015/04/16. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "YSLTransitionAnimator.h" 10 | 11 | @implementation YSLTransitionAnimator 12 | 13 | - (id)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | } 18 | return self; 19 | } 20 | 21 | - (NSTimeInterval)transitionDuration:(id)transitionContext 22 | { 23 | return self.animationDuration; 24 | } 25 | 26 | - (void)animateTransition:(id)transitionContext 27 | { 28 | // get controller 29 | UIViewController *fromViewController = 30 | (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 31 | 32 | UIViewController *toViewController = 33 | (UIViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 34 | 35 | UIView *containerView = [transitionContext containerView]; 36 | NSTimeInterval duration = [self transitionDuration:transitionContext]; 37 | 38 | // fromViewController Setting 39 | UIImageView *fromTransitionImage = _isForward ? [fromViewController pushTransitionImageView] : [fromViewController popTransitionImageView]; 40 | // UIView *imageSnapshot = [fromTransitionImage snapshotViewAfterScreenUpdates:NO]; 41 | UIImageView *imageSnapshot = [[UIImageView alloc]initWithImage:fromTransitionImage.image]; 42 | imageSnapshot.layer.cornerRadius = fromTransitionImage.layer.cornerRadius; 43 | 44 | imageSnapshot.frame = [containerView convertRect:fromTransitionImage.frame fromView:fromTransitionImage.superview]; 45 | fromTransitionImage.hidden = YES; 46 | 47 | // toViewController Setting 48 | UIImageView *toTransitionImage = _isForward ? [toViewController popTransitionImageView] : [toViewController pushTransitionImageView]; 49 | toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; 50 | 51 | if (_isForward) { 52 | // push Animation 53 | toViewController.view.alpha = 0; 54 | [containerView addSubview:toViewController.view]; 55 | toTransitionImage.hidden = YES; 56 | toTransitionImage.image = fromTransitionImage.image; 57 | [containerView addSubview:imageSnapshot]; 58 | 59 | [UIView animateWithDuration:duration animations:^{ 60 | toViewController.view.alpha = 1.0; 61 | CGRect frame = [containerView convertRect:toTransitionImage.frame fromView:toViewController.view]; 62 | frame.origin.y = _toViewControllerImagePointY; 63 | imageSnapshot.frame = frame; 64 | 65 | imageSnapshot.transform = CGAffineTransformMakeScale(1.05, 1.05); 66 | } completion:^(BOOL finished) { 67 | 68 | [UIView animateWithDuration:0.25 animations:^{ 69 | imageSnapshot.transform = CGAffineTransformMakeScale(1.0, 1.0); 70 | } completion:^(BOOL finished) { 71 | 72 | [imageSnapshot removeFromSuperview]; 73 | fromTransitionImage.hidden = NO; 74 | toTransitionImage.hidden = NO; 75 | // transition end 76 | [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; 77 | }]; 78 | 79 | }]; 80 | } else { 81 | // pop Animation 82 | toTransitionImage.hidden = YES; 83 | [containerView insertSubview:toViewController.view belowSubview:fromViewController.view]; 84 | [containerView addSubview:imageSnapshot]; 85 | [UIView animateWithDuration:duration animations:^{ 86 | fromViewController.view.alpha = 0.0; 87 | imageSnapshot.frame = [containerView convertRect:toTransitionImage.frame fromView:toTransitionImage.superview]; 88 | } completion:^(BOOL finished) { 89 | 90 | [imageSnapshot removeFromSuperview]; 91 | fromTransitionImage.hidden = NO; 92 | toTransitionImage.hidden = NO; 93 | // transition end 94 | [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; 95 | }]; 96 | } 97 | } 98 | 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D044A9A21B032BDD00D0ABFD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9A11B032BDD00D0ABFD /* main.m */; }; 11 | D044A9A51B032BDD00D0ABFD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9A41B032BDD00D0ABFD /* AppDelegate.m */; }; 12 | D044A9AB1B032BDD00D0ABFD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D044A9A91B032BDD00D0ABFD /* Main.storyboard */; }; 13 | D044A9AD1B032BDD00D0ABFD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D044A9AC1B032BDD00D0ABFD /* Images.xcassets */; }; 14 | D044A9B01B032BDD00D0ABFD /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = D044A9AE1B032BDD00D0ABFD /* LaunchScreen.xib */; }; 15 | D044A9BC1B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9BB1B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.m */; }; 16 | D044A9CE1B032EDE00D0ABFD /* SelectTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9CD1B032EDE00D0ABFD /* SelectTableViewController.m */; }; 17 | D044A9D21B0331CD00D0ABFD /* CollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9D01B0331CD00D0ABFD /* CollectionViewController.m */; }; 18 | D044A9D31B0331CD00D0ABFD /* CollectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D044A9D11B0331CD00D0ABFD /* CollectionViewController.xib */; }; 19 | D044A9D81B03338B00D0ABFD /* CollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D044A9D61B03338B00D0ABFD /* CollectionCell.m */; }; 20 | D044A9D91B03338B00D0ABFD /* CollectionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D044A9D71B03338B00D0ABFD /* CollectionCell.xib */; }; 21 | D051A6411B03482A0046AF1C /* photo_sample_01.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63A1B03482A0046AF1C /* photo_sample_01.png */; }; 22 | D051A6421B03482A0046AF1C /* photo_sample_02.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63B1B03482A0046AF1C /* photo_sample_02.png */; }; 23 | D051A6431B03482A0046AF1C /* photo_sample_03.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63C1B03482A0046AF1C /* photo_sample_03.png */; }; 24 | D051A6441B03482A0046AF1C /* photo_sample_04.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63D1B03482A0046AF1C /* photo_sample_04.png */; }; 25 | D051A6451B03482A0046AF1C /* photo_sample_05.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63E1B03482A0046AF1C /* photo_sample_05.png */; }; 26 | D051A6461B03482A0046AF1C /* photo_sample_06.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A63F1B03482A0046AF1C /* photo_sample_06.png */; }; 27 | D051A6471B03482A0046AF1C /* photo_sample_07.png in Resources */ = {isa = PBXBuildFile; fileRef = D051A6401B03482A0046AF1C /* photo_sample_07.png */; }; 28 | D051A64D1B034BFF0046AF1C /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D051A64B1B034BFF0046AF1C /* TableViewController.m */; }; 29 | D051A64E1B034BFF0046AF1C /* TableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D051A64C1B034BFF0046AF1C /* TableViewController.xib */; }; 30 | D051A6521B0350410046AF1C /* TableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D051A6501B0350410046AF1C /* TableCell.m */; }; 31 | D051A6531B0350410046AF1C /* TableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D051A6511B0350410046AF1C /* TableCell.xib */; }; 32 | D051A6591B0359630046AF1C /* UIViewController+YSLTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = D051A6561B0359630046AF1C /* UIViewController+YSLTransition.m */; }; 33 | D051A65A1B0359630046AF1C /* YSLTransitionAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = D051A6581B0359630046AF1C /* YSLTransitionAnimator.m */; }; 34 | D09C83021B0C6598009FEE8D /* CollectionDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09C83001B0C6598009FEE8D /* CollectionDetailViewController.m */; }; 35 | D09C83031B0C6598009FEE8D /* CollectionDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D09C83011B0C6598009FEE8D /* CollectionDetailViewController.xib */; }; 36 | D09C83071B0C70AA009FEE8D /* TableDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D09C83051B0C70AA009FEE8D /* TableDetailViewController.m */; }; 37 | D09C83081B0C70AA009FEE8D /* TableDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D09C83061B0C70AA009FEE8D /* TableDetailViewController.xib */; }; 38 | D09C830C1B0C77DE009FEE8D /* TableDetailViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = D09C830A1B0C77DE009FEE8D /* TableDetailViewController2.m */; }; 39 | D09C830D1B0C77DE009FEE8D /* TableDetailViewController2.xib in Resources */ = {isa = PBXBuildFile; fileRef = D09C830B1B0C77DE009FEE8D /* TableDetailViewController2.xib */; }; 40 | D09C831C1B0C9E9B009FEE8D /* ysl_navi_back_btn@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D09C831B1B0C9E9B009FEE8D /* ysl_navi_back_btn@2x.png */; }; 41 | /* End PBXBuildFile section */ 42 | 43 | /* Begin PBXContainerItemProxy section */ 44 | D044A9B61B032BDD00D0ABFD /* PBXContainerItemProxy */ = { 45 | isa = PBXContainerItemProxy; 46 | containerPortal = D044A9941B032BDD00D0ABFD /* Project object */; 47 | proxyType = 1; 48 | remoteGlobalIDString = D044A99B1B032BDD00D0ABFD; 49 | remoteInfo = YSLTransitionAnimatorDemo; 50 | }; 51 | /* End PBXContainerItemProxy section */ 52 | 53 | /* Begin PBXFileReference section */ 54 | D044A99C1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YSLTransitionAnimatorDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | D044A9A01B032BDD00D0ABFD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | D044A9A11B032BDD00D0ABFD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 57 | D044A9A31B032BDD00D0ABFD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 58 | D044A9A41B032BDD00D0ABFD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 59 | D044A9AA1B032BDD00D0ABFD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 60 | D044A9AC1B032BDD00D0ABFD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 61 | D044A9AF1B032BDD00D0ABFD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 62 | D044A9B51B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YSLTransitionAnimatorDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | D044A9BA1B032BDD00D0ABFD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | D044A9BB1B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YSLTransitionAnimatorDemoTests.m; sourceTree = ""; }; 65 | D044A9CC1B032EDE00D0ABFD /* SelectTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectTableViewController.h; sourceTree = ""; }; 66 | D044A9CD1B032EDE00D0ABFD /* SelectTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SelectTableViewController.m; sourceTree = ""; }; 67 | D044A9CF1B0331CD00D0ABFD /* CollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionViewController.h; sourceTree = ""; }; 68 | D044A9D01B0331CD00D0ABFD /* CollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionViewController.m; sourceTree = ""; }; 69 | D044A9D11B0331CD00D0ABFD /* CollectionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CollectionViewController.xib; sourceTree = ""; }; 70 | D044A9D51B03338B00D0ABFD /* CollectionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionCell.h; sourceTree = ""; }; 71 | D044A9D61B03338B00D0ABFD /* CollectionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionCell.m; sourceTree = ""; }; 72 | D044A9D71B03338B00D0ABFD /* CollectionCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CollectionCell.xib; sourceTree = ""; }; 73 | D051A63A1B03482A0046AF1C /* photo_sample_01.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_01.png; sourceTree = ""; }; 74 | D051A63B1B03482A0046AF1C /* photo_sample_02.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_02.png; sourceTree = ""; }; 75 | D051A63C1B03482A0046AF1C /* photo_sample_03.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_03.png; sourceTree = ""; }; 76 | D051A63D1B03482A0046AF1C /* photo_sample_04.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_04.png; sourceTree = ""; }; 77 | D051A63E1B03482A0046AF1C /* photo_sample_05.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_05.png; sourceTree = ""; }; 78 | D051A63F1B03482A0046AF1C /* photo_sample_06.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_06.png; sourceTree = ""; }; 79 | D051A6401B03482A0046AF1C /* photo_sample_07.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo_sample_07.png; sourceTree = ""; }; 80 | D051A64A1B034BFF0046AF1C /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; 81 | D051A64B1B034BFF0046AF1C /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; 82 | D051A64C1B034BFF0046AF1C /* TableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableViewController.xib; sourceTree = ""; }; 83 | D051A64F1B0350410046AF1C /* TableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCell.h; sourceTree = ""; }; 84 | D051A6501B0350410046AF1C /* TableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableCell.m; sourceTree = ""; }; 85 | D051A6511B0350410046AF1C /* TableCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableCell.xib; sourceTree = ""; }; 86 | D051A6551B0359630046AF1C /* UIViewController+YSLTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+YSLTransition.h"; sourceTree = ""; }; 87 | D051A6561B0359630046AF1C /* UIViewController+YSLTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+YSLTransition.m"; sourceTree = ""; }; 88 | D051A6571B0359630046AF1C /* YSLTransitionAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YSLTransitionAnimator.h; sourceTree = ""; }; 89 | D051A6581B0359630046AF1C /* YSLTransitionAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YSLTransitionAnimator.m; sourceTree = ""; }; 90 | D09C82FF1B0C6598009FEE8D /* CollectionDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionDetailViewController.h; sourceTree = ""; }; 91 | D09C83001B0C6598009FEE8D /* CollectionDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionDetailViewController.m; sourceTree = ""; }; 92 | D09C83011B0C6598009FEE8D /* CollectionDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CollectionDetailViewController.xib; sourceTree = ""; }; 93 | D09C83041B0C70AA009FEE8D /* TableDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDetailViewController.h; sourceTree = ""; }; 94 | D09C83051B0C70AA009FEE8D /* TableDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDetailViewController.m; sourceTree = ""; }; 95 | D09C83061B0C70AA009FEE8D /* TableDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableDetailViewController.xib; sourceTree = ""; }; 96 | D09C83091B0C77DE009FEE8D /* TableDetailViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDetailViewController2.h; sourceTree = ""; }; 97 | D09C830A1B0C77DE009FEE8D /* TableDetailViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDetailViewController2.m; sourceTree = ""; }; 98 | D09C830B1B0C77DE009FEE8D /* TableDetailViewController2.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TableDetailViewController2.xib; sourceTree = ""; }; 99 | D09C831B1B0C9E9B009FEE8D /* ysl_navi_back_btn@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ysl_navi_back_btn@2x.png"; sourceTree = ""; }; 100 | /* End PBXFileReference section */ 101 | 102 | /* Begin PBXFrameworksBuildPhase section */ 103 | D044A9991B032BDD00D0ABFD /* Frameworks */ = { 104 | isa = PBXFrameworksBuildPhase; 105 | buildActionMask = 2147483647; 106 | files = ( 107 | ); 108 | runOnlyForDeploymentPostprocessing = 0; 109 | }; 110 | D044A9B21B032BDD00D0ABFD /* Frameworks */ = { 111 | isa = PBXFrameworksBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | ); 115 | runOnlyForDeploymentPostprocessing = 0; 116 | }; 117 | /* End PBXFrameworksBuildPhase section */ 118 | 119 | /* Begin PBXGroup section */ 120 | D044A9931B032BDC00D0ABFD = { 121 | isa = PBXGroup; 122 | children = ( 123 | D044A99E1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo */, 124 | D044A9B81B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests */, 125 | D044A99D1B032BDD00D0ABFD /* Products */, 126 | ); 127 | sourceTree = ""; 128 | }; 129 | D044A99D1B032BDD00D0ABFD /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | D044A99C1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo.app */, 133 | D044A9B51B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.xctest */, 134 | ); 135 | name = Products; 136 | sourceTree = ""; 137 | }; 138 | D044A99E1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | D051A6541B0359630046AF1C /* YSLTransitionAnimator */, 142 | D051A6391B03482A0046AF1C /* Resources */, 143 | D044A9C51B032DD900D0ABFD /* ViewControllers */, 144 | D044A9D41B03335F00D0ABFD /* Cells */, 145 | D044A9A31B032BDD00D0ABFD /* AppDelegate.h */, 146 | D044A9A41B032BDD00D0ABFD /* AppDelegate.m */, 147 | D044A9CC1B032EDE00D0ABFD /* SelectTableViewController.h */, 148 | D044A9CD1B032EDE00D0ABFD /* SelectTableViewController.m */, 149 | D044A9A91B032BDD00D0ABFD /* Main.storyboard */, 150 | D044A9AC1B032BDD00D0ABFD /* Images.xcassets */, 151 | D044A9AE1B032BDD00D0ABFD /* LaunchScreen.xib */, 152 | D044A99F1B032BDD00D0ABFD /* Supporting Files */, 153 | ); 154 | path = YSLTransitionAnimatorDemo; 155 | sourceTree = ""; 156 | }; 157 | D044A99F1B032BDD00D0ABFD /* Supporting Files */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | D044A9A01B032BDD00D0ABFD /* Info.plist */, 161 | D044A9A11B032BDD00D0ABFD /* main.m */, 162 | ); 163 | name = "Supporting Files"; 164 | sourceTree = ""; 165 | }; 166 | D044A9B81B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | D044A9BB1B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.m */, 170 | D044A9B91B032BDD00D0ABFD /* Supporting Files */, 171 | ); 172 | path = YSLTransitionAnimatorDemoTests; 173 | sourceTree = ""; 174 | }; 175 | D044A9B91B032BDD00D0ABFD /* Supporting Files */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | D044A9BA1B032BDD00D0ABFD /* Info.plist */, 179 | ); 180 | name = "Supporting Files"; 181 | sourceTree = ""; 182 | }; 183 | D044A9C51B032DD900D0ABFD /* ViewControllers */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | D051A6481B034BB90046AF1C /* CollectionView */, 187 | D051A6491B034BC90046AF1C /* TableView */, 188 | ); 189 | name = ViewControllers; 190 | sourceTree = ""; 191 | }; 192 | D044A9D41B03335F00D0ABFD /* Cells */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | D044A9D51B03338B00D0ABFD /* CollectionCell.h */, 196 | D044A9D61B03338B00D0ABFD /* CollectionCell.m */, 197 | D044A9D71B03338B00D0ABFD /* CollectionCell.xib */, 198 | D051A64F1B0350410046AF1C /* TableCell.h */, 199 | D051A6501B0350410046AF1C /* TableCell.m */, 200 | D051A6511B0350410046AF1C /* TableCell.xib */, 201 | ); 202 | name = Cells; 203 | sourceTree = ""; 204 | }; 205 | D051A6391B03482A0046AF1C /* Resources */ = { 206 | isa = PBXGroup; 207 | children = ( 208 | D051A63A1B03482A0046AF1C /* photo_sample_01.png */, 209 | D051A63B1B03482A0046AF1C /* photo_sample_02.png */, 210 | D051A63C1B03482A0046AF1C /* photo_sample_03.png */, 211 | D051A63D1B03482A0046AF1C /* photo_sample_04.png */, 212 | D051A63E1B03482A0046AF1C /* photo_sample_05.png */, 213 | D051A63F1B03482A0046AF1C /* photo_sample_06.png */, 214 | D051A6401B03482A0046AF1C /* photo_sample_07.png */, 215 | ); 216 | path = Resources; 217 | sourceTree = ""; 218 | }; 219 | D051A6481B034BB90046AF1C /* CollectionView */ = { 220 | isa = PBXGroup; 221 | children = ( 222 | D09C831D1B0D8BEF009FEE8D /* Main */, 223 | D09C831E1B0D8BF9009FEE8D /* Detail */, 224 | ); 225 | name = CollectionView; 226 | sourceTree = ""; 227 | }; 228 | D051A6491B034BC90046AF1C /* TableView */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | D09C83201B0D8C28009FEE8D /* Main */, 232 | D09C831F1B0D8C1F009FEE8D /* Detail */, 233 | ); 234 | name = TableView; 235 | sourceTree = ""; 236 | }; 237 | D051A6541B0359630046AF1C /* YSLTransitionAnimator */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | D09C830E1B0C972F009FEE8D /* Resources */, 241 | D051A6551B0359630046AF1C /* UIViewController+YSLTransition.h */, 242 | D051A6561B0359630046AF1C /* UIViewController+YSLTransition.m */, 243 | D051A6571B0359630046AF1C /* YSLTransitionAnimator.h */, 244 | D051A6581B0359630046AF1C /* YSLTransitionAnimator.m */, 245 | ); 246 | path = YSLTransitionAnimator; 247 | sourceTree = SOURCE_ROOT; 248 | }; 249 | D09C830E1B0C972F009FEE8D /* Resources */ = { 250 | isa = PBXGroup; 251 | children = ( 252 | D09C831B1B0C9E9B009FEE8D /* ysl_navi_back_btn@2x.png */, 253 | ); 254 | path = Resources; 255 | sourceTree = ""; 256 | }; 257 | D09C831D1B0D8BEF009FEE8D /* Main */ = { 258 | isa = PBXGroup; 259 | children = ( 260 | D044A9CF1B0331CD00D0ABFD /* CollectionViewController.h */, 261 | D044A9D01B0331CD00D0ABFD /* CollectionViewController.m */, 262 | D044A9D11B0331CD00D0ABFD /* CollectionViewController.xib */, 263 | ); 264 | name = Main; 265 | sourceTree = ""; 266 | }; 267 | D09C831E1B0D8BF9009FEE8D /* Detail */ = { 268 | isa = PBXGroup; 269 | children = ( 270 | D09C82FF1B0C6598009FEE8D /* CollectionDetailViewController.h */, 271 | D09C83001B0C6598009FEE8D /* CollectionDetailViewController.m */, 272 | D09C83011B0C6598009FEE8D /* CollectionDetailViewController.xib */, 273 | ); 274 | name = Detail; 275 | sourceTree = ""; 276 | }; 277 | D09C831F1B0D8C1F009FEE8D /* Detail */ = { 278 | isa = PBXGroup; 279 | children = ( 280 | D09C83041B0C70AA009FEE8D /* TableDetailViewController.h */, 281 | D09C83051B0C70AA009FEE8D /* TableDetailViewController.m */, 282 | D09C83061B0C70AA009FEE8D /* TableDetailViewController.xib */, 283 | D09C83091B0C77DE009FEE8D /* TableDetailViewController2.h */, 284 | D09C830A1B0C77DE009FEE8D /* TableDetailViewController2.m */, 285 | D09C830B1B0C77DE009FEE8D /* TableDetailViewController2.xib */, 286 | ); 287 | name = Detail; 288 | sourceTree = ""; 289 | }; 290 | D09C83201B0D8C28009FEE8D /* Main */ = { 291 | isa = PBXGroup; 292 | children = ( 293 | D051A64A1B034BFF0046AF1C /* TableViewController.h */, 294 | D051A64B1B034BFF0046AF1C /* TableViewController.m */, 295 | D051A64C1B034BFF0046AF1C /* TableViewController.xib */, 296 | ); 297 | name = Main; 298 | sourceTree = ""; 299 | }; 300 | /* End PBXGroup section */ 301 | 302 | /* Begin PBXNativeTarget section */ 303 | D044A99B1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo */ = { 304 | isa = PBXNativeTarget; 305 | buildConfigurationList = D044A9BF1B032BDD00D0ABFD /* Build configuration list for PBXNativeTarget "YSLTransitionAnimatorDemo" */; 306 | buildPhases = ( 307 | D044A9981B032BDD00D0ABFD /* Sources */, 308 | D044A9991B032BDD00D0ABFD /* Frameworks */, 309 | D044A99A1B032BDD00D0ABFD /* Resources */, 310 | ); 311 | buildRules = ( 312 | ); 313 | dependencies = ( 314 | ); 315 | name = YSLTransitionAnimatorDemo; 316 | productName = YSLTransitionAnimatorDemo; 317 | productReference = D044A99C1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo.app */; 318 | productType = "com.apple.product-type.application"; 319 | }; 320 | D044A9B41B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests */ = { 321 | isa = PBXNativeTarget; 322 | buildConfigurationList = D044A9C21B032BDD00D0ABFD /* Build configuration list for PBXNativeTarget "YSLTransitionAnimatorDemoTests" */; 323 | buildPhases = ( 324 | D044A9B11B032BDD00D0ABFD /* Sources */, 325 | D044A9B21B032BDD00D0ABFD /* Frameworks */, 326 | D044A9B31B032BDD00D0ABFD /* Resources */, 327 | ); 328 | buildRules = ( 329 | ); 330 | dependencies = ( 331 | D044A9B71B032BDD00D0ABFD /* PBXTargetDependency */, 332 | ); 333 | name = YSLTransitionAnimatorDemoTests; 334 | productName = YSLTransitionAnimatorDemoTests; 335 | productReference = D044A9B51B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.xctest */; 336 | productType = "com.apple.product-type.bundle.unit-test"; 337 | }; 338 | /* End PBXNativeTarget section */ 339 | 340 | /* Begin PBXProject section */ 341 | D044A9941B032BDD00D0ABFD /* Project object */ = { 342 | isa = PBXProject; 343 | attributes = { 344 | LastUpgradeCheck = 0620; 345 | ORGANIZATIONNAME = h.yamaguchi; 346 | TargetAttributes = { 347 | D044A99B1B032BDD00D0ABFD = { 348 | CreatedOnToolsVersion = 6.2; 349 | }; 350 | D044A9B41B032BDD00D0ABFD = { 351 | CreatedOnToolsVersion = 6.2; 352 | TestTargetID = D044A99B1B032BDD00D0ABFD; 353 | }; 354 | }; 355 | }; 356 | buildConfigurationList = D044A9971B032BDD00D0ABFD /* Build configuration list for PBXProject "YSLTransitionAnimatorDemo" */; 357 | compatibilityVersion = "Xcode 3.2"; 358 | developmentRegion = English; 359 | hasScannedForEncodings = 0; 360 | knownRegions = ( 361 | en, 362 | Base, 363 | ); 364 | mainGroup = D044A9931B032BDC00D0ABFD; 365 | productRefGroup = D044A99D1B032BDD00D0ABFD /* Products */; 366 | projectDirPath = ""; 367 | projectRoot = ""; 368 | targets = ( 369 | D044A99B1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo */, 370 | D044A9B41B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests */, 371 | ); 372 | }; 373 | /* End PBXProject section */ 374 | 375 | /* Begin PBXResourcesBuildPhase section */ 376 | D044A99A1B032BDD00D0ABFD /* Resources */ = { 377 | isa = PBXResourcesBuildPhase; 378 | buildActionMask = 2147483647; 379 | files = ( 380 | D044A9D91B03338B00D0ABFD /* CollectionCell.xib in Resources */, 381 | D044A9D31B0331CD00D0ABFD /* CollectionViewController.xib in Resources */, 382 | D051A6421B03482A0046AF1C /* photo_sample_02.png in Resources */, 383 | D051A6461B03482A0046AF1C /* photo_sample_06.png in Resources */, 384 | D051A6451B03482A0046AF1C /* photo_sample_05.png in Resources */, 385 | D09C83031B0C6598009FEE8D /* CollectionDetailViewController.xib in Resources */, 386 | D051A6431B03482A0046AF1C /* photo_sample_03.png in Resources */, 387 | D09C830D1B0C77DE009FEE8D /* TableDetailViewController2.xib in Resources */, 388 | D044A9AB1B032BDD00D0ABFD /* Main.storyboard in Resources */, 389 | D044A9B01B032BDD00D0ABFD /* LaunchScreen.xib in Resources */, 390 | D044A9AD1B032BDD00D0ABFD /* Images.xcassets in Resources */, 391 | D051A64E1B034BFF0046AF1C /* TableViewController.xib in Resources */, 392 | D09C83081B0C70AA009FEE8D /* TableDetailViewController.xib in Resources */, 393 | D09C831C1B0C9E9B009FEE8D /* ysl_navi_back_btn@2x.png in Resources */, 394 | D051A6411B03482A0046AF1C /* photo_sample_01.png in Resources */, 395 | D051A6441B03482A0046AF1C /* photo_sample_04.png in Resources */, 396 | D051A6531B0350410046AF1C /* TableCell.xib in Resources */, 397 | D051A6471B03482A0046AF1C /* photo_sample_07.png in Resources */, 398 | ); 399 | runOnlyForDeploymentPostprocessing = 0; 400 | }; 401 | D044A9B31B032BDD00D0ABFD /* Resources */ = { 402 | isa = PBXResourcesBuildPhase; 403 | buildActionMask = 2147483647; 404 | files = ( 405 | ); 406 | runOnlyForDeploymentPostprocessing = 0; 407 | }; 408 | /* End PBXResourcesBuildPhase section */ 409 | 410 | /* Begin PBXSourcesBuildPhase section */ 411 | D044A9981B032BDD00D0ABFD /* Sources */ = { 412 | isa = PBXSourcesBuildPhase; 413 | buildActionMask = 2147483647; 414 | files = ( 415 | D044A9D21B0331CD00D0ABFD /* CollectionViewController.m in Sources */, 416 | D051A64D1B034BFF0046AF1C /* TableViewController.m in Sources */, 417 | D09C83021B0C6598009FEE8D /* CollectionDetailViewController.m in Sources */, 418 | D044A9D81B03338B00D0ABFD /* CollectionCell.m in Sources */, 419 | D09C830C1B0C77DE009FEE8D /* TableDetailViewController2.m in Sources */, 420 | D044A9CE1B032EDE00D0ABFD /* SelectTableViewController.m in Sources */, 421 | D051A6591B0359630046AF1C /* UIViewController+YSLTransition.m in Sources */, 422 | D051A6521B0350410046AF1C /* TableCell.m in Sources */, 423 | D09C83071B0C70AA009FEE8D /* TableDetailViewController.m in Sources */, 424 | D044A9A51B032BDD00D0ABFD /* AppDelegate.m in Sources */, 425 | D044A9A21B032BDD00D0ABFD /* main.m in Sources */, 426 | D051A65A1B0359630046AF1C /* YSLTransitionAnimator.m in Sources */, 427 | ); 428 | runOnlyForDeploymentPostprocessing = 0; 429 | }; 430 | D044A9B11B032BDD00D0ABFD /* Sources */ = { 431 | isa = PBXSourcesBuildPhase; 432 | buildActionMask = 2147483647; 433 | files = ( 434 | D044A9BC1B032BDD00D0ABFD /* YSLTransitionAnimatorDemoTests.m in Sources */, 435 | ); 436 | runOnlyForDeploymentPostprocessing = 0; 437 | }; 438 | /* End PBXSourcesBuildPhase section */ 439 | 440 | /* Begin PBXTargetDependency section */ 441 | D044A9B71B032BDD00D0ABFD /* PBXTargetDependency */ = { 442 | isa = PBXTargetDependency; 443 | target = D044A99B1B032BDD00D0ABFD /* YSLTransitionAnimatorDemo */; 444 | targetProxy = D044A9B61B032BDD00D0ABFD /* PBXContainerItemProxy */; 445 | }; 446 | /* End PBXTargetDependency section */ 447 | 448 | /* Begin PBXVariantGroup section */ 449 | D044A9A91B032BDD00D0ABFD /* Main.storyboard */ = { 450 | isa = PBXVariantGroup; 451 | children = ( 452 | D044A9AA1B032BDD00D0ABFD /* Base */, 453 | ); 454 | name = Main.storyboard; 455 | sourceTree = ""; 456 | }; 457 | D044A9AE1B032BDD00D0ABFD /* LaunchScreen.xib */ = { 458 | isa = PBXVariantGroup; 459 | children = ( 460 | D044A9AF1B032BDD00D0ABFD /* Base */, 461 | ); 462 | name = LaunchScreen.xib; 463 | sourceTree = ""; 464 | }; 465 | /* End PBXVariantGroup section */ 466 | 467 | /* Begin XCBuildConfiguration section */ 468 | D044A9BD1B032BDD00D0ABFD /* Debug */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | ALWAYS_SEARCH_USER_PATHS = NO; 472 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 473 | CLANG_CXX_LIBRARY = "libc++"; 474 | CLANG_ENABLE_MODULES = YES; 475 | CLANG_ENABLE_OBJC_ARC = YES; 476 | CLANG_WARN_BOOL_CONVERSION = YES; 477 | CLANG_WARN_CONSTANT_CONVERSION = YES; 478 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 479 | CLANG_WARN_EMPTY_BODY = YES; 480 | CLANG_WARN_ENUM_CONVERSION = YES; 481 | CLANG_WARN_INT_CONVERSION = YES; 482 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 483 | CLANG_WARN_UNREACHABLE_CODE = YES; 484 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 485 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 486 | COPY_PHASE_STRIP = NO; 487 | ENABLE_STRICT_OBJC_MSGSEND = YES; 488 | GCC_C_LANGUAGE_STANDARD = gnu99; 489 | GCC_DYNAMIC_NO_PIC = NO; 490 | GCC_OPTIMIZATION_LEVEL = 0; 491 | GCC_PREPROCESSOR_DEFINITIONS = ( 492 | "DEBUG=1", 493 | "$(inherited)", 494 | ); 495 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 496 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 497 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 498 | GCC_WARN_UNDECLARED_SELECTOR = YES; 499 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 500 | GCC_WARN_UNUSED_FUNCTION = YES; 501 | GCC_WARN_UNUSED_VARIABLE = YES; 502 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 503 | MTL_ENABLE_DEBUG_INFO = YES; 504 | ONLY_ACTIVE_ARCH = YES; 505 | SDKROOT = iphoneos; 506 | }; 507 | name = Debug; 508 | }; 509 | D044A9BE1B032BDD00D0ABFD /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | buildSettings = { 512 | ALWAYS_SEARCH_USER_PATHS = NO; 513 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 514 | CLANG_CXX_LIBRARY = "libc++"; 515 | CLANG_ENABLE_MODULES = YES; 516 | CLANG_ENABLE_OBJC_ARC = YES; 517 | CLANG_WARN_BOOL_CONVERSION = YES; 518 | CLANG_WARN_CONSTANT_CONVERSION = YES; 519 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 520 | CLANG_WARN_EMPTY_BODY = YES; 521 | CLANG_WARN_ENUM_CONVERSION = YES; 522 | CLANG_WARN_INT_CONVERSION = YES; 523 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 524 | CLANG_WARN_UNREACHABLE_CODE = YES; 525 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 526 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 527 | COPY_PHASE_STRIP = NO; 528 | ENABLE_NS_ASSERTIONS = NO; 529 | ENABLE_STRICT_OBJC_MSGSEND = YES; 530 | GCC_C_LANGUAGE_STANDARD = gnu99; 531 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 532 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 533 | GCC_WARN_UNDECLARED_SELECTOR = YES; 534 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 535 | GCC_WARN_UNUSED_FUNCTION = YES; 536 | GCC_WARN_UNUSED_VARIABLE = YES; 537 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 538 | MTL_ENABLE_DEBUG_INFO = NO; 539 | SDKROOT = iphoneos; 540 | VALIDATE_PRODUCT = YES; 541 | }; 542 | name = Release; 543 | }; 544 | D044A9C01B032BDD00D0ABFD /* Debug */ = { 545 | isa = XCBuildConfiguration; 546 | buildSettings = { 547 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 548 | INFOPLIST_FILE = YSLTransitionAnimatorDemo/Info.plist; 549 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 550 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 551 | PRODUCT_NAME = "$(TARGET_NAME)"; 552 | }; 553 | name = Debug; 554 | }; 555 | D044A9C11B032BDD00D0ABFD /* Release */ = { 556 | isa = XCBuildConfiguration; 557 | buildSettings = { 558 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 559 | INFOPLIST_FILE = YSLTransitionAnimatorDemo/Info.plist; 560 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 561 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 562 | PRODUCT_NAME = "$(TARGET_NAME)"; 563 | }; 564 | name = Release; 565 | }; 566 | D044A9C31B032BDD00D0ABFD /* Debug */ = { 567 | isa = XCBuildConfiguration; 568 | buildSettings = { 569 | BUNDLE_LOADER = "$(TEST_HOST)"; 570 | FRAMEWORK_SEARCH_PATHS = ( 571 | "$(SDKROOT)/Developer/Library/Frameworks", 572 | "$(inherited)", 573 | ); 574 | GCC_PREPROCESSOR_DEFINITIONS = ( 575 | "DEBUG=1", 576 | "$(inherited)", 577 | ); 578 | INFOPLIST_FILE = YSLTransitionAnimatorDemoTests/Info.plist; 579 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 580 | PRODUCT_NAME = "$(TARGET_NAME)"; 581 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YSLTransitionAnimatorDemo.app/YSLTransitionAnimatorDemo"; 582 | }; 583 | name = Debug; 584 | }; 585 | D044A9C41B032BDD00D0ABFD /* Release */ = { 586 | isa = XCBuildConfiguration; 587 | buildSettings = { 588 | BUNDLE_LOADER = "$(TEST_HOST)"; 589 | FRAMEWORK_SEARCH_PATHS = ( 590 | "$(SDKROOT)/Developer/Library/Frameworks", 591 | "$(inherited)", 592 | ); 593 | INFOPLIST_FILE = YSLTransitionAnimatorDemoTests/Info.plist; 594 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 595 | PRODUCT_NAME = "$(TARGET_NAME)"; 596 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YSLTransitionAnimatorDemo.app/YSLTransitionAnimatorDemo"; 597 | }; 598 | name = Release; 599 | }; 600 | /* End XCBuildConfiguration section */ 601 | 602 | /* Begin XCConfigurationList section */ 603 | D044A9971B032BDD00D0ABFD /* Build configuration list for PBXProject "YSLTransitionAnimatorDemo" */ = { 604 | isa = XCConfigurationList; 605 | buildConfigurations = ( 606 | D044A9BD1B032BDD00D0ABFD /* Debug */, 607 | D044A9BE1B032BDD00D0ABFD /* Release */, 608 | ); 609 | defaultConfigurationIsVisible = 0; 610 | defaultConfigurationName = Release; 611 | }; 612 | D044A9BF1B032BDD00D0ABFD /* Build configuration list for PBXNativeTarget "YSLTransitionAnimatorDemo" */ = { 613 | isa = XCConfigurationList; 614 | buildConfigurations = ( 615 | D044A9C01B032BDD00D0ABFD /* Debug */, 616 | D044A9C11B032BDD00D0ABFD /* Release */, 617 | ); 618 | defaultConfigurationIsVisible = 0; 619 | defaultConfigurationName = Release; 620 | }; 621 | D044A9C21B032BDD00D0ABFD /* Build configuration list for PBXNativeTarget "YSLTransitionAnimatorDemoTests" */ = { 622 | isa = XCConfigurationList; 623 | buildConfigurations = ( 624 | D044A9C31B032BDD00D0ABFD /* Debug */, 625 | D044A9C41B032BDD00D0ABFD /* Release */, 626 | ); 627 | defaultConfigurationIsVisible = 0; 628 | defaultConfigurationName = Release; 629 | }; 630 | /* End XCConfigurationList section */ 631 | }; 632 | rootObject = D044A9941B032BDD00D0ABFD /* Project object */; 633 | } 634 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionCell.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CollectionCell : UICollectionViewCell 12 | 13 | @property (nonatomic, weak) IBOutlet UIImageView *itemImage; 14 | @property (nonatomic, weak) IBOutlet UILabel *itemLabel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionCell.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "CollectionCell.h" 10 | 11 | @implementation CollectionCell 12 | 13 | - (void)awakeFromNib { 14 | // Initialization code 15 | self.itemImage.layer.cornerRadius = 7.0f; 16 | self.itemImage.clipsToBounds = YES; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionDetailViewController.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CollectionDetailViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionDetailViewController.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "CollectionDetailViewController.h" 10 | 11 | #import "YSLTransitionAnimator.h" 12 | #import "UIViewController+YSLTransition.h" 13 | 14 | @interface CollectionDetailViewController () 15 | 16 | @property (nonatomic, weak) IBOutlet UIImageView *headerImageView; 17 | 18 | @end 19 | 20 | @implementation CollectionDetailViewController 21 | 22 | - (void)didReceiveMemoryWarning 23 | { 24 | [super didReceiveMemoryWarning]; 25 | } 26 | 27 | - (void)viewWillDisappear:(BOOL)animated 28 | { 29 | [self ysl_removeTransitionDelegate]; 30 | } 31 | 32 | - (void)viewDidAppear:(BOOL)animated 33 | { 34 | [self ysl_addTransitionDelegate:self]; 35 | [self ysl_popTransitionAnimationWithCurrentScrollView:nil 36 | cancelAnimationPointY:0 37 | animationDuration:0.3 38 | isInteractiveTransition:YES]; 39 | } 40 | 41 | 42 | - (void)viewDidLoad 43 | { 44 | [super viewDidLoad]; 45 | 46 | CGRect rect = [UIScreen mainScreen].bounds; 47 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 48 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 49 | 50 | // header 51 | // If you're using a xib and storyboard. Be sure to specify the frame 52 | _headerImageView.frame = CGRectMake(0, statusHeight + navigationHeight, rect.size.width, 250); 53 | 54 | // custom navigation left item 55 | __weak CollectionDetailViewController *weakself = self; 56 | [self ysl_setUpReturnBtnWithColor:[UIColor lightGrayColor] 57 | callBackHandler:^{ 58 | [weakself.navigationController popViewControllerAnimated:YES]; 59 | }]; 60 | } 61 | 62 | #pragma mark -- YSLTransitionAnimatorDataSource 63 | - (UIImageView *)popTransitionImageView 64 | { 65 | return self.headerImageView; 66 | } 67 | 68 | - (UIImageView *)pushTransitionImageView 69 | { 70 | return nil; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionDetailViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewController.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CollectionViewController : UICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewController.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "CollectionViewController.h" 10 | #import "CollectionCell.h" 11 | #import "CollectionDetailViewController.h" 12 | 13 | #import "YSLTransitionAnimator.h" 14 | #import "UIViewController+YSLTransition.h" 15 | 16 | @interface CollectionViewController () 17 | 18 | @property (nonatomic, strong) NSMutableArray *items; 19 | 20 | @end 21 | 22 | @implementation CollectionViewController 23 | 24 | static NSString * const reuseIdentifier = @"CollectionCell"; 25 | 26 | - (void)didReceiveMemoryWarning 27 | { 28 | [super didReceiveMemoryWarning]; 29 | } 30 | 31 | - (void)viewWillDisappear:(BOOL)animated 32 | { 33 | [self ysl_removeTransitionDelegate]; 34 | } 35 | 36 | - (void)viewDidAppear:(BOOL)animated 37 | { 38 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 39 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 40 | 41 | [self ysl_addTransitionDelegate:self]; 42 | [self ysl_pushTransitionAnimationWithToViewControllerImagePointY:statusHeight + navigationHeight 43 | animationDuration:0.3]; 44 | } 45 | 46 | - (void)viewDidLoad 47 | { 48 | [super viewDidLoad]; 49 | 50 | self.view.backgroundColor = [UIColor whiteColor]; 51 | 52 | _items = [@[@"photo_sample_01", 53 | @"photo_sample_02", 54 | @"photo_sample_03", 55 | @"photo_sample_04", 56 | @"photo_sample_05", 57 | @"photo_sample_06", 58 | @"photo_sample_07",] mutableCopy]; 59 | 60 | [self.collectionView registerNib:[UINib nibWithNibName:@"CollectionCell" bundle:nil] forCellWithReuseIdentifier:reuseIdentifier]; 61 | } 62 | 63 | #pragma mark 64 | 65 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 66 | { 67 | return 1; 68 | } 69 | 70 | 71 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 72 | { 73 | return _items.count; 74 | } 75 | 76 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 77 | { 78 | CollectionCell *cell = (CollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; 79 | 80 | cell.itemImage.image = [UIImage imageNamed:_items[indexPath.row]]; 81 | cell.itemLabel.text = [NSString stringWithFormat:@"Item Index %ld",(long)indexPath.row]; 82 | 83 | return cell; 84 | } 85 | 86 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 87 | { 88 | CollectionDetailViewController *vc = [[CollectionDetailViewController alloc]init]; 89 | [self.navigationController pushViewController:vc animated:YES]; 90 | } 91 | 92 | #pragma mark -- UICollectionViewDelegateFlowLayout 93 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 94 | { 95 | return CGSizeMake((self.view.frame.size.width / 2) - 9, (self.view.frame.size.width / 2) - 9); 96 | } 97 | 98 | #pragma mark -- YSLTransitionAnimatorDataSource 99 | - (UIImageView *)pushTransitionImageView 100 | { 101 | CollectionCell *cell = (CollectionCell *)[self.collectionView cellForItemAtIndexPath:[[self.collectionView indexPathsForSelectedItems] firstObject]]; 102 | return cell.itemImage; 103 | } 104 | 105 | - (UIImageView *)popTransitionImageView 106 | { 107 | return nil; 108 | } 109 | 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/CollectionViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | jp.-.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_01.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_02.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_03.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_04.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_05.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_06.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/Resources/photo_sample_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/YSLTransitionAnimatorDemo/Resources/photo_sample_07.png -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/SelectTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTableViewController.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SelectTableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/SelectTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SelectTableViewController.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "SelectTableViewController.h" 10 | #import "CollectionViewController.h" 11 | #import "TableViewController.h" 12 | 13 | @interface SelectTableViewController () 14 | 15 | @end 16 | 17 | @implementation SelectTableViewController 18 | 19 | static NSString *cellIdentifier = @"SelectTableCell"; 20 | 21 | - (void)didReceiveMemoryWarning 22 | { 23 | [super didReceiveMemoryWarning]; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | // self.clearsSelectionOnViewWillAppear = NO; 30 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellIdentifier]; 31 | } 32 | 33 | #pragma mark - Table view data source 34 | 35 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 36 | { 37 | return 1; 38 | } 39 | 40 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 41 | { 42 | return 2; 43 | } 44 | 45 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 46 | { 47 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 48 | 49 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 50 | cell.textLabel.font = [UIFont fontWithName:@"Futura-Medium" size:16]; 51 | 52 | switch (indexPath.row) { 53 | case 0: 54 | cell.textLabel.text = @"CollectionView"; 55 | break; 56 | case 1: 57 | 58 | cell.textLabel.text = @"TableView"; 59 | break; 60 | default:break; 61 | } 62 | 63 | return cell; 64 | } 65 | 66 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 67 | { 68 | switch (indexPath.row) { 69 | case 0: 70 | { 71 | CollectionViewController *vc = [[CollectionViewController alloc]initWithNibName:@"CollectionViewController" bundle:nil]; 72 | [self.navigationController pushViewController:vc animated:YES]; 73 | } 74 | break; 75 | case 1: 76 | { 77 | TableViewController *vc = [[TableViewController alloc]initWithNibName:@"TableViewController" bundle:nil]; 78 | [self.navigationController pushViewController:vc animated:YES]; 79 | } 80 | break; 81 | default:break; 82 | } 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableCell.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableCell : UITableViewCell 12 | 13 | @property (nonatomic, weak) IBOutlet UIImageView *itemImage; 14 | @property (nonatomic, weak) IBOutlet UILabel *itemLabel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableCell.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "TableCell.h" 10 | 11 | @implementation TableCell 12 | 13 | - (void)awakeFromNib { 14 | // Initialization code 15 | } 16 | 17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 18 | [super setSelected:selected animated:animated]; 19 | 20 | // Configure the view for the selected state 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableDetailViewController.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableDetailViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableDetailViewController.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "TableDetailViewController.h" 10 | #import "TableCell.h" 11 | 12 | #import "YSLTransitionAnimator.h" 13 | #import "UIViewController+YSLTransition.h" 14 | #import "TableDetailViewController2.h" 15 | 16 | @interface TableDetailViewController () 17 | 18 | @property (nonatomic, weak) IBOutlet UITableView *tableView; 19 | @property (nonatomic, strong) NSMutableArray *items; 20 | @property (nonatomic, strong) UIImageView *headerImageView; 21 | 22 | @end 23 | 24 | @implementation TableDetailViewController 25 | 26 | - (void)didReceiveMemoryWarning 27 | { 28 | [super didReceiveMemoryWarning]; 29 | } 30 | 31 | - (void)viewWillDisappear:(BOOL)animated 32 | { 33 | [self ysl_removeTransitionDelegate]; 34 | } 35 | 36 | - (void)viewDidAppear:(BOOL)animated 37 | { 38 | if ([self.tableView indexPathForSelectedRow] ) { 39 | [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; 40 | } 41 | 42 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 43 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 44 | 45 | [self ysl_addTransitionDelegate:self]; 46 | // push 47 | [self ysl_pushTransitionAnimationWithToViewControllerImagePointY:100 48 | animationDuration:0.3]; 49 | // pop 50 | [self ysl_popTransitionAnimationWithCurrentScrollView:self.tableView 51 | cancelAnimationPointY:self.headerImageView.frame.size.height - (statusHeight + navigationHeight) 52 | animationDuration:0.3 53 | isInteractiveTransition:YES]; 54 | } 55 | 56 | - (void)viewDidLoad 57 | { 58 | [super viewDidLoad]; 59 | 60 | self.view.backgroundColor = [UIColor whiteColor]; 61 | 62 | _items = [@[@"photo_sample_01", 63 | @"photo_sample_02", 64 | @"photo_sample_03", 65 | @"photo_sample_04", 66 | @"photo_sample_05", 67 | @"photo_sample_06", 68 | @"photo_sample_07",] mutableCopy]; 69 | 70 | [self.tableView registerNib:[UINib nibWithNibName:@"TableCell" bundle:nil] forCellReuseIdentifier:@"TableCell"]; 71 | [self createTableHaaderView]; 72 | } 73 | 74 | - (void)createTableHaaderView 75 | { 76 | CGRect rect = [UIScreen mainScreen].bounds; 77 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 78 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 79 | 80 | UIView *headerBackView = [[UIView alloc]init]; 81 | headerBackView.frame = CGRectMake(0, statusHeight + navigationHeight, rect.size.width, 255); 82 | 83 | self.headerImageView = [[UIImageView alloc]init]; 84 | self.headerImageView.frame = CGRectMake(0, 0, rect.size.width, 250); 85 | [headerBackView addSubview:self.headerImageView]; 86 | 87 | self.tableView.tableHeaderView = headerBackView; 88 | } 89 | 90 | #pragma mark - Table view data source 91 | 92 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 93 | { 94 | return 1; 95 | } 96 | 97 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 98 | { 99 | return _items.count; 100 | } 101 | 102 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 103 | { 104 | return 120; 105 | } 106 | 107 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 108 | { 109 | static NSString *cellIdentifier = @"TableCell"; 110 | TableCell *cell = (TableCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 111 | cell.itemImage.image = [UIImage imageNamed:_items[indexPath.row]]; 112 | cell.itemLabel.text = [NSString stringWithFormat:@"Item Index %ld",(long)indexPath.row]; 113 | return cell; 114 | } 115 | 116 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 117 | { 118 | TableDetailViewController2 *vc = [[TableDetailViewController2 alloc]init]; 119 | [self.navigationController pushViewController:vc animated:YES]; 120 | } 121 | 122 | #pragma mark -- YSLTransitionAnimatorDataSource 123 | - (UIImageView *)popTransitionImageView 124 | { 125 | return self.headerImageView; 126 | } 127 | 128 | - (UIImageView *)pushTransitionImageView 129 | { 130 | TableCell *cell = (TableCell *)[self.tableView cellForRowAtIndexPath:[self.tableView indexPathForSelectedRow]]; 131 | return cell.itemImage; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController2.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableDetailViewController2.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableDetailViewController2 : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController2.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableDetailViewController2.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/20. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "TableDetailViewController2.h" 10 | 11 | #import "YSLTransitionAnimator.h" 12 | #import "UIViewController+YSLTransition.h" 13 | 14 | @interface TableDetailViewController2 () 15 | 16 | @property (nonatomic, strong) UIImageView *imageView; 17 | 18 | @end 19 | 20 | @implementation TableDetailViewController2 21 | 22 | - (void)didReceiveMemoryWarning 23 | { 24 | [super didReceiveMemoryWarning]; 25 | } 26 | 27 | - (void)viewWillDisappear:(BOOL)animated 28 | { 29 | [self ysl_removeTransitionDelegate]; 30 | } 31 | 32 | - (void)viewDidAppear:(BOOL)animated 33 | { 34 | [super viewDidAppear:animated]; 35 | [self ysl_addTransitionDelegate:self]; 36 | // pop 37 | [self ysl_popTransitionAnimationWithCurrentScrollView:nil 38 | cancelAnimationPointY:0 39 | animationDuration:0.3 40 | isInteractiveTransition:YES]; 41 | } 42 | 43 | - (void)viewDidLoad 44 | { 45 | [super viewDidLoad]; 46 | 47 | self.view.backgroundColor = [UIColor whiteColor]; 48 | 49 | CGRect rect = [UIScreen mainScreen].bounds; 50 | 51 | // header 52 | self.imageView = [[UIImageView alloc]init]; 53 | self.imageView.frame = CGRectMake(rect.size.width / 2 - (200 / 2), 100, 200, 200); 54 | [self.view addSubview:self.imageView]; 55 | self.imageView.backgroundColor = [UIColor lightGrayColor]; 56 | 57 | // label 58 | UILabel *label = [[UILabel alloc]init]; 59 | label.frame = CGRectMake(10, 60 | self.imageView.frame.origin.y + self.imageView.frame.size.height + 50, 61 | rect.size.width - 20, 62 | 100); 63 | label.font = [UIFont fontWithName:@"Futura-Medium" size:22]; 64 | label.textAlignment = NSTextAlignmentCenter; 65 | label.text = @"TableDetailViewController2"; 66 | [self.view addSubview:label]; 67 | } 68 | 69 | #pragma mark -- YSLTransitionAnimatorDataSource 70 | - (UIImageView *)popTransitionImageView 71 | { 72 | return self.imageView; 73 | } 74 | 75 | - (UIImageView *)pushTransitionImageView 76 | { 77 | return nil; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableDetailViewController2.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.h 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import "TableViewController.h" 10 | #import "TableCell.h" 11 | #import "TableDetailViewController.h" 12 | 13 | #import "YSLTransitionAnimator.h" 14 | #import "UIViewController+YSLTransition.h" 15 | 16 | @interface TableViewController () 17 | 18 | @property (nonatomic, strong) NSMutableArray *items; 19 | 20 | @end 21 | 22 | @implementation TableViewController 23 | 24 | - (void)didReceiveMemoryWarning 25 | { 26 | [super didReceiveMemoryWarning]; 27 | } 28 | 29 | - (void)viewWillDisappear:(BOOL)animated 30 | { 31 | [self ysl_removeTransitionDelegate]; 32 | } 33 | 34 | - (void)viewDidAppear:(BOOL)animated 35 | { 36 | if ([self.tableView indexPathForSelectedRow] ) { 37 | [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; 38 | } 39 | 40 | float statusHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; 41 | float navigationHeight = self.navigationController.navigationBar.frame.size.height; 42 | 43 | [self ysl_addTransitionDelegate:self]; 44 | [self ysl_pushTransitionAnimationWithToViewControllerImagePointY:statusHeight + navigationHeight 45 | animationDuration:0.3]; 46 | } 47 | 48 | - (void)viewDidLoad 49 | { 50 | [super viewDidLoad]; 51 | 52 | self.view.backgroundColor = [UIColor whiteColor]; 53 | 54 | _items = [@[@"photo_sample_01", 55 | @"photo_sample_02", 56 | @"photo_sample_03", 57 | @"photo_sample_04", 58 | @"photo_sample_05", 59 | @"photo_sample_06", 60 | @"photo_sample_07",] mutableCopy]; 61 | 62 | [self.tableView registerNib:[UINib nibWithNibName:@"TableCell" bundle:nil] forCellReuseIdentifier:@"TableCell"]; 63 | } 64 | 65 | #pragma mark - Table view data source 66 | 67 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 68 | { 69 | return 1; 70 | } 71 | 72 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 73 | { 74 | return _items.count; 75 | } 76 | 77 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 78 | { 79 | return 120; 80 | } 81 | 82 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 83 | { 84 | static NSString *cellIdentifier = @"TableCell"; 85 | TableCell *cell = (TableCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 86 | cell.itemImage.image = [UIImage imageNamed:_items[indexPath.row]]; 87 | cell.itemLabel.text = [NSString stringWithFormat:@"Item Index %ld",(long)indexPath.row]; 88 | return cell; 89 | } 90 | 91 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 92 | { 93 | TableDetailViewController *vc = [[TableDetailViewController alloc]init]; 94 | self.navigationController.delegate = self; 95 | [self.navigationController pushViewController:vc animated:YES]; 96 | } 97 | 98 | #pragma mark -- YSLTransitionAnimatorDataSource 99 | - (UIImageView *)pushTransitionImageView 100 | { 101 | TableCell *cell = (TableCell *)[self.tableView cellForRowAtIndexPath:[self.tableView indexPathForSelectedRow]]; 102 | return cell.itemImage; 103 | } 104 | 105 | - (UIImageView *)popTransitionImageView 106 | { 107 | return nil; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/TableViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // YSLTransitionAnimatorDemo 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | jp.-.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /YSLTransitionAnimatorDemoTests/YSLTransitionAnimatorDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // YSLTransitionAnimatorDemoTests.m 3 | // YSLTransitionAnimatorDemoTests 4 | // 5 | // Created by yamaguchi on 2015/05/13. 6 | // Copyright (c) 2015年 h.yamaguchi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface YSLTransitionAnimatorDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation YSLTransitionAnimatorDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /sample_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/sample_01.gif -------------------------------------------------------------------------------- /sample_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/y-hryk/YSLTransitionAnimator/db857bd4fb0a42ce83d94ff6e1eb3bf2c71a9c82/sample_02.gif --------------------------------------------------------------------------------