├── .DS_Store
├── .gitignore
├── Image
├── .DS_Store
├── home-menu.png
├── 图片浏览器.gif
└── 效果展示.gif
├── LYCustomTransitionDemo.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── liyang.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── liyang.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── LYCustomTransitionDemo.xcscheme
│ └── xcschememanagement.plist
├── LYCustomTransitionDemo.xcworkspace
├── contents.xcworkspacedata
└── xcuserdata
│ └── liyang.xcuserdatad
│ ├── UserInterfaceState.xcuserstate
│ └── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
├── LYCustomTransitionDemo
├── .DS_Store
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── CATransition
│ ├── .DS_Store
│ ├── Modal-CATransition
│ │ ├── LYModalCATransitionFirstVC.h
│ │ ├── LYModalCATransitionFirstVC.m
│ │ ├── LYModalCATransitionSecondVC.h
│ │ └── LYModalCATransitionSecondVC.m
│ └── Nav-CATransition
│ │ ├── LYNavCATransitionFirstVC.h
│ │ ├── LYNavCATransitionFirstVC.m
│ │ ├── LYNavCATransitionSecondVC.h
│ │ └── LYNavCATransitionSecondVC.m
├── Info.plist
├── LYCustomTransitonHomeVC.h
├── LYCustomTransitonHomeVC.m
├── Main.storyboard
├── Modal-Transition
│ ├── .DS_Store
│ ├── Modal-Base
│ │ ├── LYModalBaseSecondVC.h
│ │ ├── LYModalBaseSecondVC.m
│ │ ├── LYModalBaseVC.h
│ │ └── LYModalBaseVC.m
│ ├── Modal-KuGou-Interactive
│ │ ├── LYModalKuGouInteractiveAnimatedTransition.h
│ │ ├── LYModalKuGouInteractiveAnimatedTransition.m
│ │ ├── LYModalKuGouInteractiveSecondVC.h
│ │ ├── LYModalKuGouInteractiveSecondVC.m
│ │ ├── LYModalKuGouInteractiveVC.h
│ │ ├── LYModalKuGouInteractiveVC.m
│ │ ├── LYModalKuGouPercentDerivenInteractive.h
│ │ └── LYModalKuGouPercentDerivenInteractive.m
│ ├── Modal-KuGou
│ │ ├── LYModalKuGouAnimationTransition.h
│ │ ├── LYModalKuGouAnimationTransition.m
│ │ ├── LYModalKuGouSecondVC.h
│ │ ├── LYModalKuGouSecondVC.m
│ │ ├── LYModalKuGouVC.h
│ │ └── LYModalKuGouVC.m
│ ├── Modal-WeChat-Interactive
│ │ ├── LYModalWeChatInteractiveAnimatedTransition.h
│ │ ├── LYModalWeChatInteractiveAnimatedTransition.m
│ │ ├── LYModalWeChatInteractiveSecondVC.h
│ │ ├── LYModalWeChatInteractiveSecondVC.m
│ │ ├── LYModalWeChatInteractiveVC.h
│ │ ├── LYModalWeChatInteractiveVC.m
│ │ ├── LYModalWeChatPercentDrivenInteractive.h
│ │ └── LYModalWeChatPercentDrivenInteractive.m
│ └── Modal-WeChat
│ │ ├── LYModal-WeChat-AnimationTransition.h
│ │ ├── LYModal-WeChat-AnimationTransition.m
│ │ ├── LYModal-WeChatSecondVC.h
│ │ ├── LYModal-WeChatSecondVC.m
│ │ ├── LYModalWeChatVC.h
│ │ └── LYModalWeChatVC.m
├── Navigation-Transition
│ ├── .DS_Store
│ ├── Nav-Base-InteractiveTransition
│ │ ├── LYNavBaseInteractiveAnimatedTransition.h
│ │ ├── LYNavBaseInteractiveAnimatedTransition.m
│ │ ├── LYNavBaseInteractiveSecondVC.h
│ │ ├── LYNavBaseInteractiveSecondVC.m
│ │ ├── LYNavBaseInteractiveVC.h
│ │ ├── LYNavBaseInteractiveVC.m
│ │ ├── LYNavBasePercentDerivenInteractive.h
│ │ └── LYNavBasePercentDerivenInteractive.m
│ ├── Nav-BaseTransition
│ │ ├── LYNavBaseCustomAnimator.h
│ │ ├── LYNavBaseCustomAnimator.m
│ │ ├── LYNavBaseSecondVC.h
│ │ ├── LYNavBaseSecondVC.m
│ │ ├── LYNavBaseVC.h
│ │ └── LYNavBaseVC.m
│ ├── Nav-KuGou-InteractiveTransition
│ │ ├── LYNavKuGouInteractiveAnimatedTransition.h
│ │ ├── LYNavKuGouInteractiveAnimatedTransition.m
│ │ ├── LYNavKuGouInteractiveSecondVC.h
│ │ ├── LYNavKuGouInteractiveSecondVC.m
│ │ ├── LYNavKuGouInteractiveVC.h
│ │ ├── LYNavKuGouInteractiveVC.m
│ │ ├── LYNavKuGouPercentDerivenInteractive.h
│ │ └── LYNavKuGouPercentDerivenInteractive.m
│ ├── Nav-KuGouTransiton
│ │ ├── LYNavKuGouAnimationTransition.h
│ │ ├── LYNavKuGouAnimationTransition.m
│ │ ├── LYNavKuGouPopAnimator.h
│ │ ├── LYNavKuGouPopAnimator.m
│ │ ├── LYNavKuGouPushAnimator.h
│ │ ├── LYNavKuGouPushAnimator.m
│ │ ├── LYNavKugouSecondVC.h
│ │ ├── LYNavKugouSecondVC.m
│ │ ├── LYNavKugouVC.h
│ │ └── LYNavKugouVC.m
│ ├── Nav-WeChat-InteractiveTransition
│ │ ├── LYNavWeChatInteractiveAnimatedTransition.h
│ │ ├── LYNavWeChatInteractiveAnimatedTransition.m
│ │ ├── LYNavWeChatInteractivePopAnimator.h
│ │ ├── LYNavWeChatInteractivePopAnimator.m
│ │ ├── LYNavWeChatInteractivePushAnimator.h
│ │ ├── LYNavWeChatInteractivePushAnimator.m
│ │ ├── LYNavWeChatInteractiveSecondVC.h
│ │ ├── LYNavWeChatInteractiveSecondVC.m
│ │ ├── LYNavWeChatInteractiveVC.h
│ │ ├── LYNavWeChatInteractiveVC.m
│ │ ├── LYNavWeChatPercentDrivenInteractive.h
│ │ └── LYNavWeChatPercentDrivenInteractive.m
│ └── Nav-WeChatTransiton
│ │ ├── LYNavWeChatAnimationTransition.h
│ │ ├── LYNavWeChatAnimationTransition.m
│ │ ├── LYNavWeChatPopAnimator.h
│ │ ├── LYNavWeChatPopAnimator.m
│ │ ├── LYNavWeChatPushAnimator.h
│ │ ├── LYNavWeChatPushAnimator.m
│ │ ├── LYNavWeChatSecondVC.h
│ │ ├── LYNavWeChatSecondVC.m
│ │ ├── LYNavWeChatVC.h
│ │ └── LYNavWeChatVC.m
├── Net-Friends-Questions
│ ├── .DS_Store
│ ├── Questions-one
│ │ ├── LYQuestionOneCell.h
│ │ ├── LYQuestionOneCell.m
│ │ ├── LYQuestionsOneAnimationTrasition.h
│ │ ├── LYQuestionsOneAnimationTrasition.m
│ │ ├── LYQuestionsOneFirstVC.h
│ │ ├── LYQuestionsOneFirstVC.m
│ │ ├── LYQuestionsOnePopAnimator.h
│ │ ├── LYQuestionsOnePopAnimator.m
│ │ ├── LYQuestionsOnePushAnimator.h
│ │ ├── LYQuestionsOnePushAnimator.m
│ │ ├── LYQuestionsOneSecondVC.h
│ │ └── LYQuestionsOneSecondVC.m
│ └── Questions-two
│ │ ├── LYQuestionTwoAnimationTransition.h
│ │ ├── LYQuestionTwoAnimationTransition.m
│ │ ├── LYQuestionTwoFirstVC.h
│ │ ├── LYQuestionTwoFirstVC.m
│ │ ├── LYQuestionTwoPopAnimator.h
│ │ ├── LYQuestionTwoPopAnimator.m
│ │ ├── LYQuestionTwoPushAnimator.h
│ │ ├── LYQuestionTwoPushAnimator.m
│ │ ├── LYQuestionTwoSecondVC.h
│ │ └── LYQuestionTwoSecondVC.m
├── PictureBrowse
│ ├── .DS_Store
│ ├── LYPictureBrowse
│ │ ├── .DS_Store
│ │ ├── Controller
│ │ │ ├── LYPictureBrowseViewController.h
│ │ │ └── LYPictureBrowseViewController.m
│ │ ├── LYPictureBrowse.h
│ │ ├── Model
│ │ │ ├── LYPictureBrowseSouceModel.h
│ │ │ └── LYPictureBrowseSouceModel.m
│ │ ├── Transition
│ │ │ ├── LYPictureBrowseInteractiveAnimatedTransition.h
│ │ │ ├── LYPictureBrowseInteractiveAnimatedTransition.m
│ │ │ ├── LYPictureBrowsePercentDrivenInteractive.h
│ │ │ ├── LYPictureBrowsePercentDrivenInteractive.m
│ │ │ ├── LYPictureBrowsePopAnimator.h
│ │ │ ├── LYPictureBrowsePopAnimator.m
│ │ │ ├── LYPictureBrowsePushAnimator.h
│ │ │ ├── LYPictureBrowsePushAnimator.m
│ │ │ ├── LYPictureBrowseTransitionParameter.h
│ │ │ └── LYPictureBrowseTransitionParameter.m
│ │ └── View
│ │ │ ├── LYBrowseZoomScrollView.h
│ │ │ ├── LYBrowseZoomScrollView.m
│ │ │ ├── LYPictureBrowserCell.h
│ │ │ └── LYPictureBrowserCell.m
│ ├── LYPictureFirstPageCell.h
│ ├── LYPictureFirstPageCell.m
│ ├── LYPictureFirstVC.h
│ └── LYPictureFirstVC.m
├── PrefixHeader.pch
├── Resource
│ ├── .DS_Store
│ ├── Base.png
│ ├── CATransition.png
│ ├── Expression
│ │ ├── .DS_Store
│ │ ├── Expression01.jpeg
│ │ ├── Expression02.jpeg
│ │ ├── Expression03.jpeg
│ │ ├── Expression04.jpeg
│ │ ├── Expression05.jpeg
│ │ ├── Expression06.jpeg
│ │ ├── Expression07.jpeg
│ │ ├── Expression08.jpeg
│ │ ├── Expression09.gif
│ │ ├── Expression10.jpeg
│ │ ├── Expression11.jpeg
│ │ ├── Expression12.jpeg
│ │ ├── Expression13.jpeg
│ │ ├── Expression14.gif
│ │ └── Expression15.jpeg
│ ├── Wechat-Interactive.jpeg
│ ├── back@2x.png
│ ├── content.png
│ ├── flip.png
│ ├── kugoou.png
│ ├── kugou-Interactive.jpeg
│ ├── nodata.png
│ ├── wechat.jpg
│ └── 美女与豪车
│ │ ├── BeautyCar01.jpg
│ │ ├── BeautyCar02.jpg
│ │ ├── BeautyCar03.jpg
│ │ ├── BeautyCar04.jpg
│ │ └── BeautyCar05.jpg
├── UIViewController+hook.h
├── UIViewController+hook.m
├── ViewController.h
├── ViewController.m
└── main.m
├── LYCustomTransitionDemoTests
├── Info.plist
└── LYCustomTransitionDemoTests.m
├── LYCustomTransitionDemoUITests
├── Info.plist
└── LYCustomTransitionDemoUITests.m
├── Podfile
├── Podfile.lock
├── Pods
├── Manifest.lock
├── Pods.xcodeproj
│ ├── project.pbxproj
│ └── xcuserdata
│ │ └── liyang.xcuserdatad
│ │ └── xcschemes
│ │ ├── Pods-LYCustomTransitionDemo.xcscheme
│ │ ├── SDWebImage.xcscheme
│ │ └── xcschememanagement.plist
├── SDWebImage
│ ├── LICENSE
│ ├── README.md
│ └── SDWebImage
│ │ ├── NSData+ImageContentType.h
│ │ ├── NSData+ImageContentType.m
│ │ ├── SDImageCache.h
│ │ ├── SDImageCache.m
│ │ ├── SDWebImageCompat.h
│ │ ├── SDWebImageCompat.m
│ │ ├── SDWebImageDecoder.h
│ │ ├── SDWebImageDecoder.m
│ │ ├── SDWebImageDownloader.h
│ │ ├── SDWebImageDownloader.m
│ │ ├── SDWebImageDownloaderOperation.h
│ │ ├── SDWebImageDownloaderOperation.m
│ │ ├── SDWebImageManager.h
│ │ ├── SDWebImageManager.m
│ │ ├── SDWebImageOperation.h
│ │ ├── SDWebImagePrefetcher.h
│ │ ├── SDWebImagePrefetcher.m
│ │ ├── UIButton+WebCache.h
│ │ ├── UIButton+WebCache.m
│ │ ├── UIImage+GIF.h
│ │ ├── UIImage+GIF.m
│ │ ├── UIImage+MultiFormat.h
│ │ ├── UIImage+MultiFormat.m
│ │ ├── UIImageView+HighlightedWebCache.h
│ │ ├── UIImageView+HighlightedWebCache.m
│ │ ├── UIImageView+WebCache.h
│ │ ├── UIImageView+WebCache.m
│ │ ├── UIView+WebCacheOperation.h
│ │ └── UIView+WebCacheOperation.m
└── Target Support Files
│ ├── Pods-LYCustomTransitionDemo
│ ├── Info.plist
│ ├── Pods-LYCustomTransitionDemo-acknowledgements.markdown
│ ├── Pods-LYCustomTransitionDemo-acknowledgements.plist
│ ├── Pods-LYCustomTransitionDemo-dummy.m
│ ├── Pods-LYCustomTransitionDemo-frameworks.sh
│ ├── Pods-LYCustomTransitionDemo-resources.sh
│ ├── Pods-LYCustomTransitionDemo-umbrella.h
│ ├── Pods-LYCustomTransitionDemo.debug.xcconfig
│ ├── Pods-LYCustomTransitionDemo.modulemap
│ └── Pods-LYCustomTransitionDemo.release.xcconfig
│ └── SDWebImage
│ ├── Info.plist
│ ├── SDWebImage-dummy.m
│ ├── SDWebImage-prefix.pch
│ ├── SDWebImage-umbrella.h
│ ├── SDWebImage.modulemap
│ └── SDWebImage.xcconfig
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | # Xcode
4 | build/*
5 | *.pbxuser
6 | !default.pbxuser
7 | *.mode1v3
8 | !default.mode1v3
9 | *.mode2v3
10 | !default.mode2v3
11 | *.perspectivev3
12 | !default.perspectivev3
13 | *.xcworkspace
14 | !default.xcworkspace
15 | xcuserdata
16 | profile
17 | *.moved-aside
18 | *.xcuserstate
--------------------------------------------------------------------------------
/Image/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/Image/.DS_Store
--------------------------------------------------------------------------------
/Image/home-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/Image/home-menu.png
--------------------------------------------------------------------------------
/Image/图片浏览器.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/Image/图片浏览器.gif
--------------------------------------------------------------------------------
/Image/效果展示.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/Image/效果展示.gif
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcodeproj/project.xcworkspace/xcuserdata/liyang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo.xcodeproj/project.xcworkspace/xcuserdata/liyang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcodeproj/xcuserdata/liyang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | LYCustomTransitionDemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | B66421701E607A1800AA95C2
16 |
17 | primary
18 |
19 |
20 | B66421891E607A1800AA95C2
21 |
22 | primary
23 |
24 |
25 | B66421941E607A1800AA95C2
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcworkspace/xcuserdata/liyang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo.xcworkspace/xcuserdata/liyang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/LYCustomTransitionDemo.xcworkspace/xcuserdata/liyang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. 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 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "LYCustomTransitonHomeVC.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 |
19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
20 | // Override point for customization after application launch.
21 |
22 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
23 | self.window.backgroundColor = [UIColor whiteColor];
24 | LYCustomTransitonHomeVC *homeVC = [[LYCustomTransitonHomeVC alloc] init];
25 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:homeVC];
26 | self.window.rootViewController = nav;
27 |
28 | [self.window makeKeyAndVisible];
29 |
30 | return YES;
31 | }
32 |
33 |
34 |
35 | - (void)applicationWillResignActive:(UIApplication *)application {
36 | // 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.
37 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
38 | }
39 |
40 |
41 | - (void)applicationDidEnterBackground:(UIApplication *)application {
42 | // 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.
43 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
44 | }
45 |
46 |
47 | - (void)applicationWillEnterForeground:(UIApplication *)application {
48 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
49 | }
50 |
51 |
52 | - (void)applicationDidBecomeActive:(UIApplication *)application {
53 | // 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.
54 | }
55 |
56 |
57 | - (void)applicationWillTerminate:(UIApplication *)application {
58 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Base.lproj/LaunchScreen.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 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/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 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/CATransition/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Modal-CATransition/LYModalCATransitionFirstVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalCATransitionFirstVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalCATransitionFirstVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Modal-CATransition/LYModalCATransitionFirstVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalCATransitionFirstVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalCATransitionFirstVC.h"
10 | #import "LYModalCATransitionSecondVC.h"
11 |
12 | @interface LYModalCATransitionFirstVC ()
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYModalCATransitionFirstVC
18 |
19 | - (void)viewDidAppear:(BOOL)animated{
20 | [super viewDidAppear:animated];
21 |
22 | self.navigationController.delegate = nil;
23 | }
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | self.title = @"Modal-CATransition";
27 | self.view.backgroundColor = bgColor;
28 | self.view.layer.masksToBounds = YES;
29 |
30 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
31 | _imgView.center = self.view.center;
32 | _imgView.image = [UIImage imageNamed:@"CATransition"];
33 | _imgView.userInteractionEnabled = YES;
34 | [self.view addSubview:_imgView];
35 |
36 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
37 | [_imgView addGestureRecognizer:tap];
38 | }
39 |
40 | - (void)pushSecond{
41 |
42 | LYModalCATransitionSecondVC *second = [[LYModalCATransitionSecondVC alloc] init];
43 | [self.view.window.layer addAnimation:[self presentAnimation] forKey:nil];//添加Animation
44 | [self presentViewController:second animated:NO completion:nil]; //记得这里的animated要设为NO,不然会重复
45 | }
46 | - (CATransition *)presentAnimation{
47 |
48 | CATransition* transition = [CATransition animation];
49 | transition.duration = 0.8;
50 | transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
51 |
52 | /*私有API
53 | cube 立方体效果
54 | pageCurl 向上翻一页
55 | pageUnCurl 向下翻一页
56 | rippleEffect 水滴波动效果
57 | suckEffect 变成小布块飞走的感觉
58 | oglFlip 上下翻转
59 | cameraIrisHollowClose 相机镜头关闭效果
60 | cameraIrisHollowOpen 相机镜头打开效果
61 | */
62 |
63 | // transition.type = @"cube";
64 | transition.type = kCATransitionPush;
65 |
66 | //下面四个是系统共有的API
67 | //kCATransitionMoveIn, kCATransitionPush, kCATransitionReveal, kCATransitionFade
68 |
69 | transition.subtype = kCATransitionFromRight;
70 | //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
71 |
72 | return transition;
73 | }
74 |
75 | @end
76 |
77 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Modal-CATransition/LYModalCATransitionSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalCATransitionSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/21.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalCATransitionSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Nav-CATransition/LYNavCATransitionFirstVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavCATransitionFirstVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavCATransitionFirstVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Nav-CATransition/LYNavCATransitionFirstVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavCATransitionFirstVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavCATransitionFirstVC.h"
10 | #import "LYNavCATransitionSecondVC.h"
11 | @interface LYNavCATransitionFirstVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYNavCATransitionFirstVC
18 |
19 | - (void)viewDidAppear:(BOOL)animated{
20 | [super viewDidAppear:animated];
21 |
22 | self.navigationController.delegate = nil;
23 | }
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 | self.title = @"Nav-CATransition";
27 | self.view.backgroundColor = bgColor;
28 | self.view.layer.masksToBounds = YES;
29 |
30 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
31 | _imgView.center = self.view.center;
32 | _imgView.image = [UIImage imageNamed:@"CATransition"];
33 | _imgView.userInteractionEnabled = YES;
34 | [self.view addSubview:_imgView];
35 |
36 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
37 | [_imgView addGestureRecognizer:tap];
38 | }
39 |
40 | - (void)pushSecond{
41 |
42 | LYNavCATransitionSecondVC *second = [[LYNavCATransitionSecondVC alloc] init];
43 | [self.navigationController.view.layer addAnimation:[self pushAnimation] forKey:nil];//添加Animation
44 | [self.navigationController pushViewController:second animated:NO]; //记得这里的animated要设为NO,不然会重复
45 | }
46 | - (CATransition *)pushAnimation{
47 |
48 | CATransition* transition = [CATransition animation];
49 | transition.duration = 0.8;
50 | transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
51 |
52 | /*私有API
53 | cube 立方体效果
54 | pageCurl 向上翻一页
55 | pageUnCurl 向下翻一页
56 | rippleEffect 水滴波动效果
57 | suckEffect 变成小布块飞走的感觉
58 | oglFlip 上下翻转
59 | cameraIrisHollowClose 相机镜头关闭效果
60 | cameraIrisHollowOpen 相机镜头打开效果
61 | */
62 |
63 | transition.type = @"cube";
64 | // transition.type = kCATransitionMoveIn;
65 |
66 | //下面四个是系统共有的API
67 | //kCATransitionMoveIn, kCATransitionPush, kCATransitionReveal, kCATransitionFade
68 |
69 | transition.subtype = kCATransitionFromRight;
70 | //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
71 |
72 | return transition;
73 | }
74 |
75 | @end
76 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/CATransition/Nav-CATransition/LYNavCATransitionSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYCATransitionSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavCATransitionSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/LYCustomTransitonHomeVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYCustomTransitonHomeVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYCustomTransitonHomeVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/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 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Modal-Transition/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-Base/LYModalBaseSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalBaseSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalBaseSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-Base/LYModalBaseSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalBaseSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalBaseSecondVC.h"
10 |
11 | @interface LYModalBaseSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYModalBaseSecondVC
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | self.view.backgroundColor = [UIColor blackColor];
22 | self.view.layer.masksToBounds = YES;
23 |
24 | UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavBarHeight)];
25 | navView.backgroundColor = [UIColor whiteColor];
26 | [self.view addSubview:navView];
27 |
28 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, kStatusBarHeight, 44, 44)];
29 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
30 | [button setTitle:@"返回" forState:UIControlStateNormal];
31 | [button addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
32 | [self.view addSubview:button];
33 |
34 |
35 | UIImage *image = [UIImage imageNamed:@"Base"];
36 | CGSize size = [self backImageSize:image];
37 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
38 | _imgView.image = image;
39 | _imgView.userInteractionEnabled = YES;
40 | [self.view addSubview:_imgView];
41 |
42 | }
43 | - (void)backBtnClick:(UIButton *)button{
44 | [self dismissViewControllerAnimated:YES completion:nil];
45 | }
46 | - (CGSize)backImageSize:(UIImage *)image{
47 |
48 | CGSize size = image.size;
49 | CGSize newSize;
50 | newSize.width = kScreenWidth;
51 | newSize.height = newSize.width / size.width * size.height;
52 |
53 | return newSize;
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-Base/LYModalBaseVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalBaseVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalBaseVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-Base/LYModalBaseVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalBaseVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalBaseVC.h"
10 | #import "LYModalBaseSecondVC.h"
11 | #import "LYNavBaseCustomAnimator.h"
12 |
13 | @interface LYModalBaseVC ()
14 |
15 | @property (nonatomic, strong) LYNavBaseCustomAnimator *customAnimator;
16 |
17 | @property (nonatomic, strong) UIImageView *imgView;
18 |
19 | @end
20 |
21 | @implementation LYModalBaseVC
22 |
23 | - (void)viewDidAppear:(BOOL)animated{
24 | [super viewDidAppear:animated];
25 | }
26 | - (void)viewDidLoad {
27 | [super viewDidLoad];
28 | self.title = @"Base";
29 | self.view.backgroundColor = bgColor;
30 | self.view.layer.masksToBounds = YES;
31 |
32 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
33 | _imgView.center = self.view.center;
34 | _imgView.image = [UIImage imageNamed:@"Base"];
35 | _imgView.userInteractionEnabled = YES;
36 | [self.view addSubview:_imgView];
37 |
38 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(presentSecond)];
39 | [_imgView addGestureRecognizer:tap];
40 | }
41 |
42 | - (void)presentSecond{
43 |
44 |
45 | LYModalBaseSecondVC *second = [[LYModalBaseSecondVC alloc] init];
46 |
47 | //1. 设置代理
48 | second.transitioningDelegate = self;
49 |
50 | //2.跳转
51 | [self presentViewController:second animated:YES completion:nil];
52 | }
53 |
54 | #pragma mark - UIViewControllerTransitioningDelegate
55 |
56 | - (nullable id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
57 | return self.customAnimator;
58 | }
59 |
60 | - (nullable id )animationControllerForDismissedController:(UIViewController *)dismissed{
61 | return self.customAnimator;
62 | }
63 |
64 |
65 | - (LYNavBaseCustomAnimator *)customAnimator
66 | {
67 | if (_customAnimator == nil) {
68 | _customAnimator = [[LYNavBaseCustomAnimator alloc]init];
69 | }
70 | return _customAnimator;
71 | }
72 | @end
73 |
74 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouInteractiveAnimatedTransition : NSObject
12 |
13 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouInteractiveAnimatedTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouInteractiveAnimatedTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouInteractiveAnimatedTransition.h"
10 |
11 | #import "LYNavKuGouPushAnimator.h"
12 | #import "LYNavKuGouPopAnimator.h"
13 | #import "LYModalKuGouPercentDerivenInteractive.h"
14 |
15 | @interface LYModalKuGouInteractiveAnimatedTransition ()
16 |
17 | @property (nonatomic, strong) LYNavKuGouPushAnimator *customPush;
18 | @property (nonatomic, strong) LYNavKuGouPopAnimator *customPop;
19 | @property (nonatomic, strong) LYModalKuGouPercentDerivenInteractive *percentIntractive;
20 |
21 |
22 | @end
23 |
24 | @implementation LYModalKuGouInteractiveAnimatedTransition
25 |
26 | - (nullable id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
27 |
28 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
29 | return self.customPush;
30 | }
31 |
32 | - (nullable id )animationControllerForDismissedController:(UIViewController *)dismissed{
33 |
34 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
35 | return self.customPop;
36 | }
37 |
38 | - (nullable id )interactionControllerForDismissal:(id )animator{
39 | if (self.gestureRecognizer)
40 | return self.percentIntractive;
41 | else
42 | return nil;
43 | }
44 |
45 |
46 | - (LYNavKuGouPushAnimator *)customPush
47 | {
48 | if (_customPush == nil) {
49 | _customPush = [[LYNavKuGouPushAnimator alloc]init];
50 | }
51 | return _customPush;
52 | }
53 |
54 | - (LYNavKuGouPopAnimator *)customPop {
55 | if (!_customPop) {
56 | _customPop = [[LYNavKuGouPopAnimator alloc] init];
57 | }
58 | return _customPop;
59 | }
60 |
61 | - (LYModalKuGouPercentDerivenInteractive *)percentIntractive{
62 | if (!_percentIntractive) {
63 | _percentIntractive = [[LYModalKuGouPercentDerivenInteractive alloc] initWithGestureRecognizer:self.gestureRecognizer];
64 | }
65 | return _percentIntractive;
66 |
67 | }
68 |
69 | @end
70 |
71 |
72 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouInteractiveSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouInteractiveSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouInteractiveSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouInteractiveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouInteractiveVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouInteractiveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouInteractiveVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouInteractiveVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouInteractiveVC.h"
10 | #import "LYModalKuGouInteractiveAnimatedTransition.h"
11 | #import "LYModalKuGouInteractiveSecondVC.h"
12 |
13 | @interface LYModalKuGouInteractiveVC ()
14 |
15 | @property (nonatomic, strong) LYModalKuGouInteractiveAnimatedTransition *animatedTransition;
16 | @property (nonatomic, strong) UIImageView *imgView;
17 |
18 | @end
19 |
20 | @implementation LYModalKuGouInteractiveVC
21 |
22 | - (void)viewDidDisappear:(BOOL)animated{
23 | [super viewDidDisappear:animated];
24 | }
25 | - (void)viewDidAppear:(BOOL)animated{
26 | [super viewDidAppear:animated];
27 | }
28 | - (void)viewWillDisappear:(BOOL)animated{
29 | [super viewWillDisappear:animated];
30 | }
31 | - (void)viewWillAppear:(BOOL)animated{
32 | [super viewWillAppear:animated];
33 | }
34 |
35 | - (void)viewDidLoad {
36 | [super viewDidLoad];
37 | self.title = @"KuGou";
38 | self.view.backgroundColor = bgColor;
39 |
40 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
41 | _imgView.center = self.view.center;
42 | _imgView.image = [UIImage imageNamed:@"kugoou"];
43 | _imgView.userInteractionEnabled = YES;
44 | [self.view addSubview:_imgView];
45 |
46 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
47 | [_imgView addGestureRecognizer:tap];
48 | }
49 |
50 | - (void)pushSecond{
51 |
52 | LYModalKuGouInteractiveSecondVC *second = [[LYModalKuGouInteractiveSecondVC alloc] init];
53 |
54 | //1. 设置代理
55 | second.transitioningDelegate = self.animatedTransition;
56 |
57 | //2.跳转
58 | [self presentViewController:second animated:YES completion:nil];
59 | }
60 |
61 |
62 | - (LYModalKuGouInteractiveAnimatedTransition *)animatedTransition{
63 | if (!_animatedTransition) {
64 | _animatedTransition = [[LYModalKuGouInteractiveAnimatedTransition alloc] init];
65 | }
66 | return _animatedTransition;
67 | }
68 |
69 | - (void)didReceiveMemoryWarning {
70 | [super didReceiveMemoryWarning];
71 | // Dispose of any resources that can be recreated.
72 | }
73 |
74 | /*
75 | #pragma mark - Navigation
76 |
77 | // In a storyboard-based application, you will often want to do a little preparation before navigation
78 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
79 | // Get the new view controller using [segue destinationViewController].
80 | // Pass the selected object to the new view controller.
81 | }
82 | */
83 |
84 | @end
85 |
86 |
87 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouPercentDerivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouPercentDerivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouPercentDerivenInteractive : UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer;
14 |
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou-Interactive/LYModalKuGouPercentDerivenInteractive.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouPercentDerivenInteractive.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouPercentDerivenInteractive.h"
10 |
11 | @interface LYModalKuGouPercentDerivenInteractive ()
12 |
13 | @property (nonatomic, strong, readonly) UIPanGestureRecognizer *gestureRecognizer;
14 |
15 | @end
16 |
17 | @implementation LYModalKuGouPercentDerivenInteractive
18 |
19 | - (void)startInteractiveTransition:(id )transitionContext{
20 |
21 | //此句话的重要性
22 | [super startInteractiveTransition:transitionContext];
23 | }
24 |
25 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
26 | {
27 | self = [super init];
28 | if (self)
29 | {
30 | _gestureRecognizer = gestureRecognizer;
31 |
32 | [_gestureRecognizer addTarget:self action:@selector(gestureRecognizeDidUpdate:)];
33 | }
34 | return self;
35 | }
36 |
37 | - (void)dealloc
38 | {
39 | [self.gestureRecognizer removeTarget:self action:@selector(gestureRecognizeDidUpdate:)];
40 | }
41 |
42 | - (CGFloat)percentForGesture:(UIPanGestureRecognizer *)gesture
43 | {
44 |
45 | CGPoint translation = [gesture translationInView:gesture.view];
46 |
47 | CGFloat scale = 1 - fabs(translation.x / kScreenWidth);
48 | scale = scale < 0 ? 0 : scale;
49 | return scale;
50 | }
51 | - (void)gestureRecognizeDidUpdate:(UIPanGestureRecognizer *)gestureRecognizer
52 | {
53 | CGFloat scale = 1 - [self percentForGesture:gestureRecognizer];
54 | NSLog(@"interactive %f",scale);
55 |
56 | switch (gestureRecognizer.state)
57 | {
58 | case UIGestureRecognizerStateBegan:
59 | //没用
60 |
61 | break;
62 | case UIGestureRecognizerStateChanged:
63 |
64 | [self updateInteractiveTransition:scale];
65 |
66 | break;
67 | case UIGestureRecognizerStateEnded:
68 |
69 | if (scale < 0.2f){
70 |
71 | [self cancelInteractiveTransition];
72 | }
73 | else{
74 | [self finishInteractiveTransition];
75 | }
76 | break;
77 | default:
78 | [self cancelInteractiveTransition];
79 | break;
80 | }
81 | }
82 |
83 |
84 |
85 | @end
86 |
87 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouAnimationTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouAnimationTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYModalKuGouAnimationTransition : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouAnimationTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouAnimationTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouAnimationTransition.h"
10 |
11 | #import "LYNavKuGouPushAnimator.h"
12 | #import "LYNavKuGouPopAnimator.h"
13 |
14 | @interface LYModalKuGouAnimationTransition ()
15 |
16 |
17 | @property (nonatomic, strong) LYNavKuGouPushAnimator *customPush;
18 | @property (nonatomic, strong) LYNavKuGouPopAnimator *customPop;
19 |
20 | @end
21 |
22 | @implementation LYModalKuGouAnimationTransition
23 |
24 | - (nullable id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
25 |
26 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
27 | return self.customPush;
28 | }
29 |
30 | - (nullable id )animationControllerForDismissedController:(UIViewController *)dismissed{
31 |
32 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
33 | return self.customPop;
34 | }
35 |
36 | - (LYNavKuGouPushAnimator *)customPush
37 | {
38 | if (_customPush == nil) {
39 | _customPush = [[LYNavKuGouPushAnimator alloc]init];
40 | }
41 | return _customPush;
42 | }
43 |
44 | - (LYNavKuGouPopAnimator *)customPop {
45 | if (!_customPop) {
46 | _customPop = [[LYNavKuGouPopAnimator alloc] init];
47 | }
48 | return _customPop;
49 | }
50 |
51 |
52 | @end
53 |
54 |
55 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouSecondVC.h"
10 |
11 | @interface LYModalKuGouSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYModalKuGouSecondVC
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 |
22 | self.title = @"Second";
23 | self.view.backgroundColor = [UIColor blackColor];
24 |
25 | UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavBarHeight)];
26 | navView.backgroundColor = [UIColor whiteColor];
27 | [self.view addSubview:navView];
28 |
29 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, kStatusBarHeight, 44, 44)];
30 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
31 | [button setTitle:@"返回" forState:UIControlStateNormal];
32 | [button addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
33 | [self.view addSubview:button];
34 |
35 | UIImage *image = [UIImage imageNamed:@"kugoou"];
36 | CGSize size = [self backImageSize:image];
37 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
38 | _imgView.image = image;
39 | _imgView.userInteractionEnabled = YES;
40 | [self.view addSubview:_imgView];
41 | }
42 | - (void)backBtnClick:(UIButton *)button{
43 | [self dismissViewControllerAnimated:YES completion:nil];
44 | }
45 |
46 | - (CGSize)backImageSize:(UIImage *)image{
47 |
48 | CGSize size = image.size;
49 | CGSize newSize;
50 | newSize.width = kScreenWidth;
51 | newSize.height = newSize.width / size.width * size.height;
52 |
53 | return newSize;
54 | }
55 | - (void)didReceiveMemoryWarning {
56 | [super didReceiveMemoryWarning];
57 | // Dispose of any resources that can be recreated.
58 | }
59 |
60 | @end
61 |
62 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalKuGouVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-KuGou/LYModalKuGouVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalKuGouVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalKuGouVC.h"
10 |
11 | #import "LYModalKuGouSecondVC.h"
12 | #import "LYModalKuGouAnimationTransition.h"
13 |
14 | @interface LYModalKuGouVC ()
15 |
16 | @property (nonatomic, strong) LYModalKuGouAnimationTransition *animatedTransition;
17 |
18 | @property (nonatomic, strong) UIImageView *imgView;
19 |
20 | @end
21 |
22 | @implementation LYModalKuGouVC
23 |
24 | - (void)viewDidDisappear:(BOOL)animated{
25 | [super viewDidDisappear:animated];
26 | }
27 | - (void)viewDidAppear:(BOOL)animated{
28 | [super viewDidAppear:animated];
29 | }
30 | - (void)viewWillDisappear:(BOOL)animated{
31 | [super viewWillDisappear:animated];
32 | }
33 | - (void)viewWillAppear:(BOOL)animated{
34 | [super viewWillAppear:animated];
35 | }
36 |
37 | - (void)viewDidLoad {
38 | [super viewDidLoad];
39 | self.title = @"KuGou";
40 | self.view.backgroundColor = bgColor;
41 |
42 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
43 | _imgView.center = self.view.center;
44 | _imgView.image = [UIImage imageNamed:@"kugoou"];
45 | _imgView.userInteractionEnabled = YES;
46 | [self.view addSubview:_imgView];
47 |
48 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
49 | [_imgView addGestureRecognizer:tap];
50 | }
51 |
52 | - (void)pushSecond{
53 |
54 | LYModalKuGouSecondVC *second = [[LYModalKuGouSecondVC alloc] init];
55 |
56 | //1. 设置代理
57 | second.transitioningDelegate = self.animatedTransition;
58 |
59 | //2.跳转
60 | [self presentViewController:second animated:YES completion:nil];
61 | }
62 |
63 | - (LYModalKuGouAnimationTransition *)animatedTransition{
64 | if (!_animatedTransition) {
65 | _animatedTransition = [[LYModalKuGouAnimationTransition alloc] init];
66 | }
67 | return _animatedTransition;
68 | }
69 |
70 | - (void)didReceiveMemoryWarning {
71 | [super didReceiveMemoryWarning];
72 | // Dispose of any resources that can be recreated.
73 | }
74 |
75 | /*
76 | #pragma mark - Navigation
77 |
78 | // In a storyboard-based application, you will often want to do a little preparation before navigation
79 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
80 | // Get the new view controller using [segue destinationViewController].
81 | // Pass the selected object to the new view controller.
82 | }
83 | */
84 |
85 | @end
86 |
87 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat-Interactive/LYModalWeChatInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalWeChatInteractiveAnimatedTransition : NSObject
12 |
13 | /** 转场过渡的图片 */
14 | - (void)setTransitionImgView:(UIImageView *)transitionImgView;
15 |
16 | /** 转场前的图片frame */
17 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
18 |
19 | /** 转场后的图片frame */
20 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
21 |
22 |
23 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
24 | @property (nonatomic, assign) CGRect currentImageViewFrame; //当前图片的frame
25 | @property (nonatomic, strong) UIImageView *currentImageView; //当前图片
26 |
27 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat-Interactive/LYModalWeChatInteractiveSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYWeChatInteractiveSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalWeChatInteractiveSecondVC : UIViewController
12 |
13 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat-Interactive/LYModalWeChatInteractiveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatInteractiveVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalWeChatInteractiveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat-Interactive/LYModalWeChatInteractiveVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatInteractiveVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalWeChatInteractiveVC.h"
10 | #import "LYModalWeChatInteractiveAnimatedTransition.h"
11 | #import "LYModalWeChatInteractiveSecondVC.h"
12 |
13 | @interface LYModalWeChatInteractiveVC ()
14 |
15 | @property (nonatomic, strong) LYModalWeChatInteractiveAnimatedTransition *animatedTransition;
16 |
17 | @property (nonatomic, strong) UIImageView *imgView;
18 | @end
19 |
20 | @implementation LYModalWeChatInteractiveVC
21 |
22 | - (void)viewDidAppear:(BOOL)animated{
23 | [super viewDidAppear:animated];
24 | }
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 | self.title = @"WeChat";
28 | self.view.backgroundColor = bgColor;
29 |
30 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(70, 100, 120, 120)];
31 | _imgView.image = [UIImage imageNamed:@"wechat.jpg"];
32 | _imgView.userInteractionEnabled = YES;
33 | [self.view addSubview:_imgView];
34 |
35 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
36 | [_imgView addGestureRecognizer:tap];
37 | }
38 |
39 | - (void)pushSecond{
40 | self.animatedTransition = nil;
41 |
42 | //1. 传入必要的3个参数
43 | [self.animatedTransition setTransitionImgView:_imgView];
44 | [self.animatedTransition setTransitionBeforeImgFrame:_imgView.frame];
45 | [self.animatedTransition setTransitionAfterImgFrame:[self backScreenImageViewRectWithImage:_imgView.image]];
46 |
47 | LYModalWeChatInteractiveSecondVC *second = [[LYModalWeChatInteractiveSecondVC alloc] init];
48 | second.beforeImageViewFrame = _imgView.frame;
49 | //2.设置代理
50 | second.transitioningDelegate = self.animatedTransition;
51 | //3.push跳转
52 | [self presentViewController:second animated:YES completion:nil];
53 | }
54 |
55 | - (LYModalWeChatInteractiveAnimatedTransition *)animatedTransition{
56 | if (!_animatedTransition) {
57 | _animatedTransition = [[LYModalWeChatInteractiveAnimatedTransition alloc] init];
58 | }
59 | return _animatedTransition;
60 | }
61 |
62 | //返回imageView在window上全屏显示时的frame
63 | - (CGRect)backScreenImageViewRectWithImage:(UIImage *)image{
64 |
65 | CGSize size = image.size;
66 | CGSize newSize;
67 | newSize.width = kScreenWidth;
68 | newSize.height = newSize.width / size.width * size.height;
69 |
70 | CGFloat imageY = (kScreenHeight - newSize.height) * 0.5;
71 |
72 | if (imageY < 0) {
73 | imageY = 0;
74 | }
75 | CGRect rect = CGRectMake(0, imageY, newSize.width, newSize.height);
76 |
77 | return rect;
78 | }
79 |
80 | @end
81 |
82 |
83 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat-Interactive/LYModalWeChatPercentDrivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatPercentDrivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalWeChatPercentDrivenInteractive : UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer*)gestureRecognizer;
14 |
15 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
16 | @property (nonatomic, assign) CGRect currentImageViewFrame; //当前图片的frame
17 | @property (nonatomic, strong) UIImageView *currentImageView; //当前图片
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModal-WeChat-AnimationTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModal-WeChat-AnimationTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYModal_WeChat_AnimationTransition : NSObject
13 |
14 | /** 转场过渡的图片 */
15 | - (void)setTransitionImgView:(UIImageView *)transitionImgView;
16 | /** 转场前的图片frame */
17 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
18 | /** 转场后的图片frame */
19 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModal-WeChat-AnimationTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModal-WeChat-AnimationTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModal-WeChat-AnimationTransition.h"
10 | #import "LYNavWeChatPushAnimator.h"
11 | #import "LYNavWeChatPopAnimator.h"
12 |
13 | @interface LYModal_WeChat_AnimationTransition ()
14 |
15 | @property (nonatomic, strong) LYNavWeChatPushAnimator *customPush;
16 | @property (nonatomic, strong) LYNavWeChatPopAnimator *customPop;
17 |
18 | @end
19 |
20 | @implementation LYModal_WeChat_AnimationTransition
21 |
22 | /** 转场过渡的图片 */
23 | - (void)setTransitionImgView:(UIImageView *)transitionImgView{
24 | self.customPush.transitionImgView = transitionImgView;
25 | self.customPop.transitionImgView = transitionImgView;
26 | }
27 |
28 | /** 转场前的图片frame */
29 | - (void)setTransitionBeforeImgFrame:(CGRect)frame{
30 | self.customPop.transitionBeforeImgFrame = frame;
31 | self.customPush.transitionBeforeImgFrame = frame;
32 | }
33 |
34 | /** 转场后的图片frame */
35 | - (void)setTransitionAfterImgFrame:(CGRect)frame{
36 | self.customPush.transitionAfterImgFrame = frame;
37 | self.customPop.transitionAfterImgFrame = frame;
38 | }
39 |
40 | - (nullable id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
41 |
42 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
43 | return self.customPush;
44 | }
45 |
46 | - (nullable id )animationControllerForDismissedController:(UIViewController *)dismissed{
47 |
48 | //动画执行者和 nav中一样,故此处不再重写,直接调用之前navigation中的创建好的类
49 | return self.customPop;
50 | }
51 |
52 | - (LYNavWeChatPushAnimator *)customPush{
53 | if (_customPush == nil) {
54 | _customPush = [[LYNavWeChatPushAnimator alloc]init];
55 | }
56 | return _customPush;
57 | }
58 |
59 | - (LYNavWeChatPopAnimator *)customPop{
60 | if (!_customPop) {
61 | _customPop = [[LYNavWeChatPopAnimator alloc] init];
62 | }
63 | return _customPop;
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModal-WeChatSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModal-WeChatSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModal_WeChatSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModal-WeChatSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModal-WeChatSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModal-WeChatSecondVC.h"
10 |
11 | @interface LYModal_WeChatSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 | @end
15 |
16 | @implementation LYModal_WeChatSecondVC
17 |
18 | - (void)viewWillDisappear:(BOOL)animated{
19 | [super viewWillDisappear:animated];
20 | _imgView.hidden = YES;
21 | }
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 |
26 | self.title = @"Second";
27 | self.view.backgroundColor = [UIColor blackColor];
28 |
29 | UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kNavBarHeight)];
30 | navView.backgroundColor = [UIColor whiteColor];
31 | [self.view addSubview:navView];
32 |
33 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, kStatusBarHeight, 44, 44)];
34 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
35 | [button setTitle:@"返回" forState:UIControlStateNormal];
36 | [button addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
37 | [self.view addSubview:button];
38 |
39 | UIImage *image = [UIImage imageNamed:@"wechat.jpg"];
40 | CGSize size = [self backImageSize:image];
41 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
42 | _imgView.image = image;
43 | _imgView.userInteractionEnabled = YES;
44 | [self.view addSubview:_imgView];
45 | }
46 |
47 | - (void)backBtnClick:(UIButton *)button{
48 | [self dismissViewControllerAnimated:YES completion:nil];
49 | }
50 |
51 | - (CGSize)backImageSize:(UIImage *)image{
52 |
53 | CGSize size = image.size;
54 | CGSize newSize;
55 | newSize.width = kScreenWidth;
56 | newSize.height = newSize.width / size.width * size.height;
57 |
58 | return newSize;
59 | }
60 |
61 | - (void)didReceiveMemoryWarning {
62 | [super didReceiveMemoryWarning];
63 | // Dispose of any resources that can be recreated.
64 | }
65 |
66 | @end
67 |
68 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModalWeChatVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYModalWeChatVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Modal-Transition/Modal-WeChat/LYModalWeChatVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYModalWeChatVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYModalWeChatVC.h"
10 | #import "LYModal-WeChatSecondVC.h"
11 | #import "LYModal-WeChat-AnimationTransition.h"
12 |
13 | @interface LYModalWeChatVC ()
14 |
15 | @property (nonatomic, strong) LYModal_WeChat_AnimationTransition *animatedTransition;
16 |
17 | @property (nonatomic, strong) UIImageView *imgView;
18 | @end
19 |
20 | @implementation LYModalWeChatVC
21 |
22 | - (void)viewDidAppear:(BOOL)animated{
23 | [super viewDidAppear:animated];
24 | }
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 | self.title = @"WeChat";
28 | self.view.backgroundColor = bgColor;
29 |
30 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(70, 100, 120, 120)];
31 | _imgView.image = [UIImage imageNamed:@"wechat.jpg"];
32 | _imgView.userInteractionEnabled = YES;
33 | [self.view addSubview:_imgView];
34 |
35 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
36 | [_imgView addGestureRecognizer:tap];
37 | }
38 |
39 | - (void)pushSecond{
40 |
41 |
42 | self.animatedTransition = nil;
43 |
44 | //1. 传入必要的3个参数
45 | [self.animatedTransition setTransitionImgView:_imgView];
46 | [self.animatedTransition setTransitionBeforeImgFrame:_imgView.frame];
47 | [self.animatedTransition setTransitionAfterImgFrame:[self backScreenImageViewRectWithImage:_imgView.image]];
48 |
49 | LYModal_WeChatSecondVC *second = [[LYModal_WeChatSecondVC alloc] init];
50 | //2.设置代理
51 | second.transitioningDelegate = self.animatedTransition;
52 | //3.push跳转
53 | [self presentViewController:second animated:YES completion:nil];
54 | }
55 |
56 | - (LYModal_WeChat_AnimationTransition *)animatedTransition{
57 | if (!_animatedTransition) {
58 | _animatedTransition = [[LYModal_WeChat_AnimationTransition alloc] init];
59 | }
60 | return _animatedTransition;
61 | }
62 |
63 | //返回imageView在window上全屏显示时的frame
64 | - (CGRect)backScreenImageViewRectWithImage:(UIImage *)image{
65 |
66 | CGSize size = image.size;
67 | CGSize newSize;
68 | newSize.width = kScreenWidth;
69 | newSize.height = newSize.width / size.width * size.height;
70 |
71 | CGFloat imageY = (kScreenHeight - newSize.height) * 0.5;
72 |
73 | if (imageY < 0) {
74 | imageY = 0;
75 | }
76 | CGRect rect = CGRectMake(0, imageY, newSize.width, newSize.height);
77 |
78 | return rect;
79 | }
80 |
81 | @end
82 |
83 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Navigation-Transition/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBaseInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavBaseInteractiveAnimatedTransition : NSObject
13 |
14 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBaseInteractiveAnimatedTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseInteractiveAnimatedTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavBaseInteractiveAnimatedTransition.h"
10 | #import "LYNavBaseCustomAnimator.h"
11 | #import "LYNavBasePercentDerivenInteractive.h"
12 |
13 | @interface LYNavBaseInteractiveAnimatedTransition ()
14 |
15 | @property (nonatomic, strong) LYNavBaseCustomAnimator *customAnimator;
16 | @property (nonatomic, strong) LYNavBasePercentDerivenInteractive *percentIntractive;
17 |
18 | @end
19 |
20 | @implementation LYNavBaseInteractiveAnimatedTransition
21 |
22 |
23 | #pragma mark - UINavigationControllerDelegate
24 |
25 | - (nullable id )navigationController:(UINavigationController *)navigationController
26 | animationControllerForOperation:(UINavigationControllerOperation)operation
27 | fromViewController:(UIViewController *)fromVC
28 | toViewController:(UIViewController *)toVC{
29 | if (operation == UINavigationControllerOperationPush) {
30 | return self.customAnimator;
31 |
32 | }else if (operation == UINavigationControllerOperationPop){
33 | return self.customAnimator;
34 | }
35 | return nil;
36 | }
37 |
38 | - (LYNavBaseCustomAnimator *)customAnimator
39 | {
40 | if (_customAnimator == nil) {
41 | _customAnimator = [[LYNavBaseCustomAnimator alloc]init];
42 | }
43 | return _customAnimator;
44 | }
45 |
46 | - (nullable id )navigationController:(UINavigationController *)navigationController
47 | interactionControllerForAnimationController:(id ) animationController{
48 |
49 | if (self.gestureRecognizer)//判断有手势,才去调用初始化
50 | return self.percentIntractive;
51 | else
52 | return nil;
53 | }
54 |
55 | - (void)setGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer{
56 | _gestureRecognizer = gestureRecognizer;
57 | }
58 | - (LYNavBasePercentDerivenInteractive *)percentIntractive{
59 | if (!_percentIntractive) {
60 | _percentIntractive = [[LYNavBasePercentDerivenInteractive alloc] initWithGestureRecognizer:self.gestureRecognizer];
61 | }
62 | return _percentIntractive;
63 | }
64 |
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBaseInteractiveSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseInteractiveSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavBaseInteractiveSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBaseInteractiveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseInteractiveVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavBaseInteractiveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBaseInteractiveVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseInteractiveVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 |
10 | #import "LYNavBaseInteractiveVC.h"
11 | #import "LYNavBaseInteractiveSecondVC.h"
12 | #import "LYNavBaseInteractiveAnimatedTransition.h"
13 |
14 | @interface LYNavBaseInteractiveVC ()
15 |
16 | @property (nonatomic, strong) LYNavBaseInteractiveAnimatedTransition *animatedTransition;
17 |
18 | @property (nonatomic, strong) UIImageView *imgView;
19 |
20 | @end
21 |
22 | @implementation LYNavBaseInteractiveVC
23 |
24 | - (void)viewDidAppear:(BOOL)animated{
25 | [super viewDidAppear:animated];
26 |
27 | self.navigationController.delegate = nil;
28 | }
29 | - (void)viewDidLoad {
30 | [super viewDidLoad];
31 | self.title = @"Base";
32 | self.view.backgroundColor = bgColor;
33 | self.view.layer.masksToBounds = YES;
34 |
35 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
36 | _imgView.center = self.view.center;
37 | _imgView.image = [UIImage imageNamed:@"Base"];
38 | _imgView.userInteractionEnabled = YES;
39 | [self.view addSubview:_imgView];
40 |
41 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
42 | [_imgView addGestureRecognizer:tap];
43 | }
44 |
45 | - (void)pushSecond{
46 |
47 | //1. 设置代理
48 | self.navigationController.delegate = self.animatedTransition;
49 |
50 | //2.push跳转
51 | LYNavBaseInteractiveSecondVC *second = [[LYNavBaseInteractiveSecondVC alloc] init];
52 | [self.navigationController pushViewController:second animated:YES];
53 | }
54 |
55 | - (LYNavBaseInteractiveAnimatedTransition *)animatedTransition{
56 | if (!_animatedTransition) {
57 | _animatedTransition = [[LYNavBaseInteractiveAnimatedTransition alloc] init];
58 | }
59 | return _animatedTransition;
60 | }
61 |
62 |
63 | @end
64 |
65 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBasePercentDerivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBasePercentDerivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavBasePercentDerivenInteractive: UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-Base-InteractiveTransition/LYNavBasePercentDerivenInteractive.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBasePercentDerivenInteractive.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/27.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavBasePercentDerivenInteractive.h"
10 |
11 | @interface LYNavBasePercentDerivenInteractive ()
12 |
13 | @property (nonatomic, strong, readonly) UIPanGestureRecognizer *gestureRecognizer;
14 |
15 | @end
16 |
17 | @implementation LYNavBasePercentDerivenInteractive
18 |
19 | //实现 UIViewControllerInteractiveTransitioning 协议的方法(必须实现)
20 | //开始交互转场
21 | - (void)startInteractiveTransition:(id )transitionContext{
22 |
23 | //相当于走到 Animator 中的代理方法去了,那里实现了具体的动画
24 | [super startInteractiveTransition:transitionContext];
25 | }
26 |
27 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
28 | {
29 | self = [super init];
30 | if (self)
31 | {
32 | _gestureRecognizer = gestureRecognizer;
33 |
34 | [_gestureRecognizer addTarget:self action:@selector(gestureRecognizeDidUpdate:)];
35 | }
36 | return self;
37 | }
38 |
39 | - (void)dealloc
40 | {
41 | [self.gestureRecognizer removeTarget:self action:@selector(gestureRecognizeDidUpdate:)];
42 | }
43 |
44 | - (CGFloat)percentForGesture:(UIPanGestureRecognizer *)gesture
45 | {
46 | CGPoint translation = [gesture translationInView:gesture.view];
47 |
48 | CGFloat scale = 1 - fabs(translation.x / kScreenWidth);
49 | scale = scale < 0 ? 0 : scale;
50 | return scale;
51 | }
52 |
53 | - (void)gestureRecognizeDidUpdate:(UIPanGestureRecognizer *)gestureRecognizer
54 | {
55 | CGFloat scale = 1 - [self percentForGesture:gestureRecognizer];
56 |
57 | switch (gestureRecognizer.state)
58 | {
59 | case UIGestureRecognizerStateBegan:
60 | //没用
61 |
62 | break;
63 | case UIGestureRecognizerStateChanged:
64 |
65 | //更新百分比
66 | [self updateInteractiveTransition:scale];
67 |
68 | break;
69 | case UIGestureRecognizerStateEnded:
70 |
71 | if (scale < 0.3){
72 | //取消转场
73 | [self cancelInteractiveTransition];
74 | }
75 | else{
76 | //完成转场
77 | [self finishInteractiveTransition];
78 | }
79 | break;
80 | default:
81 | //取消转场
82 | [self cancelInteractiveTransition];
83 | break;
84 | }
85 | }
86 |
87 | @end
88 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseCustomAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseCustomAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @interface LYNavBaseCustomAnimator : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseCustomAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseCustomAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavBaseCustomAnimator.h"
10 |
11 | @implementation LYNavBaseCustomAnimator
12 | - (NSTimeInterval)transitionDuration:(nullable id )transitionContext{
13 | return 0.4;
14 | }
15 | - (void)animateTransition:(id )transitionContext{
16 | //转场过渡的容器view
17 | UIView *containerView = [transitionContext containerView];
18 |
19 | //FromVC
20 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
21 | UIView *fromView = fromViewController.view;
22 | fromView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
23 |
24 | //ToVC
25 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
26 | UIView *toView = toViewController.view;
27 | toView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
28 |
29 | //此处判断是push,还是pop 操作
30 | BOOL isPush = ([toViewController.navigationController.viewControllers indexOfObject:toViewController] > [fromViewController.navigationController.viewControllers indexOfObject:fromViewController]);
31 |
32 | if (isPush) {
33 | [containerView addSubview:fromView];
34 | [containerView addSubview:toView];//push,这里的toView 相当于secondVC的view
35 | toView.frame = CGRectMake(kScreenWidth, kScreenHeight, kScreenWidth, kScreenHeight);
36 |
37 | // toView.transform = CGAffineTransformMake(1,0,0,0,0,0);
38 |
39 | }else{
40 | [containerView addSubview:toView];
41 | [containerView addSubview:fromView];//pop,这里的fromView 也是相当于secondVC的view
42 | fromView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
43 |
44 | }
45 | //因为secondVC的view在firstVC的view之上,所以要后添加到containerView中
46 |
47 | //动画
48 | [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
49 | if (isPush) {
50 | // toView.transform = CGAffineTransformIdentity;
51 | toView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
52 | }else{
53 | fromView.frame = CGRectMake(kScreenWidth, kScreenHeight, kScreenWidth, kScreenHeight);
54 |
55 | // fromView.transform = CGAffineTransformMake(1,0,0,0.01,0,0);
56 | }
57 | } completion:^(BOOL finished) {
58 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
59 | //设置transitionContext通知系统动画执行完毕
60 | [transitionContext completeTransition:!wasCancelled];
61 | }];
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavBaseSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavBaseSecondVC.h"
10 |
11 | @interface LYNavBaseSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYNavBaseSecondVC
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | self.title = @"BaseSecond";
22 | self.view.backgroundColor = [UIColor blackColor];
23 | self.view.layer.masksToBounds = YES;
24 | UIImage *image = [UIImage imageNamed:@"Base"];
25 | CGSize size = [self backImageSize:image];
26 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
27 | _imgView.image = image;
28 | _imgView.userInteractionEnabled = YES;
29 | [self.view addSubview:_imgView];
30 |
31 | }
32 |
33 | - (CGSize)backImageSize:(UIImage *)image{
34 |
35 | CGSize size = image.size;
36 | CGSize newSize;
37 | newSize.width = kScreenWidth;
38 | newSize.height = newSize.width / size.width * size.height;
39 |
40 | return newSize;
41 | }
42 | @end
43 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavBaseVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-BaseTransition/LYNavBaseVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavBaseVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavBaseVC.h"
10 | #import "LYNavBaseSecondVC.h"
11 | #import "LYNavBaseCustomAnimator.h"
12 |
13 | @interface LYNavBaseVC ()
14 |
15 | @property (nonatomic, strong) LYNavBaseCustomAnimator *customAnimator;
16 |
17 | @property (nonatomic, strong) UIImageView *imgView;
18 |
19 | @end
20 |
21 | @implementation LYNavBaseVC
22 |
23 | - (void)viewDidAppear:(BOOL)animated{
24 | [super viewDidAppear:animated];
25 |
26 | self.navigationController.delegate = nil;
27 | }
28 | - (void)viewDidLoad {
29 | [super viewDidLoad];
30 | self.title = @"Base";
31 | self.view.backgroundColor = bgColor;
32 | self.view.layer.masksToBounds = YES;
33 |
34 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
35 | _imgView.center = self.view.center;
36 | _imgView.image = [UIImage imageNamed:@"Base"];
37 | _imgView.userInteractionEnabled = YES;
38 | [self.view addSubview:_imgView];
39 |
40 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
41 | [_imgView addGestureRecognizer:tap];
42 | }
43 |
44 | - (void)pushSecond{
45 |
46 | //1. 设置代理
47 | self.navigationController.delegate = self;
48 |
49 | //2.push跳转
50 | LYNavBaseSecondVC *second = [[LYNavBaseSecondVC alloc] init];
51 | [self.navigationController pushViewController:second animated:YES];
52 | }
53 |
54 |
55 |
56 | #pragma mark - UINavigationControllerDelegate
57 |
58 | - (nullable id )navigationController:(UINavigationController *)navigationController
59 | animationControllerForOperation:(UINavigationControllerOperation)operation
60 | fromViewController:(UIViewController *)fromVC
61 | toViewController:(UIViewController *)toVC{
62 | if (operation == UINavigationControllerOperationPush) {
63 | return self.customAnimator;
64 |
65 | }else if (operation == UINavigationControllerOperationPop){
66 | return self.customAnimator;
67 | }
68 | return nil;
69 | }
70 |
71 | - (LYNavBaseCustomAnimator *)customAnimator
72 | {
73 | if (_customAnimator == nil) {
74 | _customAnimator = [[LYNavBaseCustomAnimator alloc]init];
75 | }
76 | return _customAnimator;
77 | }
78 | @end
79 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKuGouInteractiveAnimatedTransition : NSObject
12 |
13 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouInteractiveAnimatedTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouInteractiveAnimatedTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKuGouInteractiveAnimatedTransition.h"
10 | #import "LYNavKuGouPushAnimator.h"
11 | #import "LYNavKuGouPopAnimator.h"
12 | #import "LYNavKuGouPercentDerivenInteractive.h"
13 |
14 | @interface LYNavKuGouInteractiveAnimatedTransition ()
15 |
16 | @property (nonatomic, strong) LYNavKuGouPushAnimator *customPush;
17 | @property (nonatomic, strong) LYNavKuGouPopAnimator *customPop;
18 | @property (nonatomic, strong) LYNavKuGouPercentDerivenInteractive *percentIntractive;
19 |
20 | @end
21 | @implementation LYNavKuGouInteractiveAnimatedTransition
22 |
23 |
24 | - (nullable id )navigationController:(UINavigationController *)navigationController
25 | animationControllerForOperation:(UINavigationControllerOperation)operation
26 | fromViewController:(UIViewController *)fromVC
27 | toViewController:(UIViewController *)toVC{
28 |
29 | //此处的动画执行者和kugou非交互式中的执行者都是一样的,故此处不再重写,直接调用之前创建好的类
30 | if (operation == UINavigationControllerOperationPush) {
31 | return self.customPush;
32 |
33 | }else if (operation == UINavigationControllerOperationPop){
34 | return self.customPop;
35 | }
36 | return nil;
37 | }
38 |
39 | - (nullable id )navigationController:(UINavigationController *)navigationController
40 | interactionControllerForAnimationController:(nonnull id)animationController{
41 |
42 | if (self.gestureRecognizer)
43 | return self.percentIntractive;
44 | else
45 | return nil;
46 | }
47 | - (void)setGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer{
48 | _gestureRecognizer = gestureRecognizer;
49 | }
50 | -(LYNavKuGouPushAnimator *)customPush
51 | {
52 | if (_customPush == nil) {
53 | _customPush = [[LYNavKuGouPushAnimator alloc]init];
54 | }
55 | return _customPush;
56 | }
57 |
58 | - (LYNavKuGouPopAnimator *)customPop {
59 | if (!_customPop) {
60 | _customPop = [[LYNavKuGouPopAnimator alloc] init];
61 | }
62 | return _customPop;
63 | }
64 | - (LYNavKuGouPercentDerivenInteractive *)percentIntractive{
65 | if (!_percentIntractive) {
66 | _percentIntractive = [[LYNavKuGouPercentDerivenInteractive alloc] initWithGestureRecognizer:self.gestureRecognizer];
67 | }
68 | return _percentIntractive;
69 |
70 | }
71 |
72 | @end
73 |
74 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouInteractiveSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouInteractiveSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKuGouInteractiveSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouInteractiveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouInteractiveVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKuGouInteractiveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouPercentDerivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouPercentDerivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKuGouPercentDerivenInteractive : UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGou-InteractiveTransition/LYNavKuGouPercentDerivenInteractive.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavKuGouPercentDerivenInteractive.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKuGouPercentDerivenInteractive.h"
10 |
11 | @interface LYNavKuGouPercentDerivenInteractive ()
12 |
13 | @property (nonatomic, strong, readonly) UIPanGestureRecognizer *gestureRecognizer;
14 |
15 | @end
16 |
17 | @implementation LYNavKuGouPercentDerivenInteractive
18 |
19 | - (void)startInteractiveTransition:(id )transitionContext{
20 |
21 | //此句话的重要性
22 | [super startInteractiveTransition:transitionContext];
23 | }
24 |
25 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
26 | {
27 | self = [super init];
28 | if (self)
29 | {
30 | _gestureRecognizer = gestureRecognizer;
31 |
32 | [_gestureRecognizer addTarget:self action:@selector(gestureRecognizeDidUpdate:)];
33 | }
34 | return self;
35 | }
36 |
37 | - (void)dealloc
38 | {
39 | [self.gestureRecognizer removeTarget:self action:@selector(gestureRecognizeDidUpdate:)];
40 | }
41 |
42 | - (CGFloat)percentForGesture:(UIPanGestureRecognizer *)gesture
43 | {
44 |
45 | CGPoint translation = [gesture translationInView:gesture.view];
46 |
47 | CGFloat scale = 1 - (translation.x / kScreenWidth);
48 | scale = scale < 0 ? 0 : scale;
49 | scale = scale > 1 ? 1 : scale;
50 | return scale;
51 | }
52 | - (void)gestureRecognizeDidUpdate:(UIPanGestureRecognizer *)gestureRecognizer
53 | {
54 | CGFloat scale = 1 - [self percentForGesture:gestureRecognizer];
55 | NSLog(@"interactive %f",scale);
56 |
57 | switch (gestureRecognizer.state)
58 | {
59 | case UIGestureRecognizerStateBegan:
60 | //没用
61 |
62 | break;
63 | case UIGestureRecognizerStateChanged:
64 |
65 | [self updateInteractiveTransition:scale];
66 |
67 | break;
68 | case UIGestureRecognizerStateEnded:
69 |
70 | if (scale < 0.2f){
71 |
72 | [self cancelInteractiveTransition];
73 | }
74 | else{
75 | [self finishInteractiveTransition];
76 | }
77 | break;
78 | default:
79 | [self cancelInteractiveTransition];
80 | break;
81 | }
82 | }
83 |
84 |
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKuGouAnimationTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKuGouAnimationTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavKuGouAnimationTransition : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKuGouAnimationTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKuGouAnimationTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKuGouAnimationTransition.h"
10 |
11 | #import "LYNavKuGouPushAnimator.h"
12 | #import "LYNavKuGouPopAnimator.h"
13 |
14 | @interface LYNavKuGouAnimationTransition ()
15 |
16 | @property (nonatomic, strong) LYNavKuGouPushAnimator *customPush;
17 | @property (nonatomic, strong) LYNavKuGouPopAnimator *customPop;
18 |
19 | @end
20 |
21 | @implementation LYNavKuGouAnimationTransition
22 |
23 |
24 | - (nullable id )navigationController:(UINavigationController *)navigationController
25 | animationControllerForOperation:(UINavigationControllerOperation)operation
26 | fromViewController:(UIViewController *)fromVC
27 | toViewController:(UIViewController *)toVC{
28 | if (operation == UINavigationControllerOperationPush) {
29 | return self.customPush;
30 |
31 | }else if (operation == UINavigationControllerOperationPop){
32 | return self.customPop;
33 | }
34 | return nil;
35 | }
36 |
37 | -(LYNavKuGouPushAnimator *)customPush
38 | {
39 | if (_customPush == nil) {
40 | _customPush = [[LYNavKuGouPushAnimator alloc]init];
41 | }
42 | return _customPush;
43 | }
44 |
45 | - (LYNavKuGouPopAnimator *)customPop {
46 | if (!_customPop) {
47 | _customPop = [[LYNavKuGouPopAnimator alloc] init];
48 | }
49 | return _customPop;
50 | }
51 |
52 |
53 | @end
54 |
55 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKuGouPopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKuGouPopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavKuGouPopAnimator : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKuGouPushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKuGouPushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavKuGouPushAnimator : NSObject
13 |
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKuGouPushAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKuGouPushAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKuGouPushAnimator.h"
10 |
11 | @implementation LYNavKuGouPushAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.4;
15 | }
16 |
17 | - (void)animateTransition:(id)transitionContext{
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //ToVC
22 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
23 | UIView *toView = toViewController.view;
24 | [containerView addSubview:toView];
25 |
26 | //动画 仿射变换动画
27 | float centerX = toView.bounds.size.width * 0.5;
28 | float centerY = toView.bounds.size.height * 0.5;
29 | float x = toView.bounds.size.width * 0.5;
30 | float y = toView.bounds.size.height * 1.8;
31 |
32 | //起始位置: 原始位置绕x,y旋转45º后的位置
33 | CGAffineTransform trans = [self GetCGAffineTransformRotateAroundCenterX:centerX centerY:centerY x:x y:y angle:45.0/180.0*M_PI];
34 | toView.transform = trans;
35 |
36 | [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
37 |
38 | //终止位置: 原始位置
39 | toView.transform = CGAffineTransformIdentity;
40 |
41 | } completion:^(BOOL finished) {
42 |
43 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
44 |
45 | //设置transitionContext通知系统动画执行完毕
46 | [transitionContext completeTransition:!wasCancelled];
47 | }];
48 | }
49 |
50 | /**
51 | 仿射变换
52 |
53 | @param centerX view的中心点X坐标
54 | @param centerY view的中心点Y坐标
55 | @param x 旋转中心x坐标
56 | @param y 旋转中心y坐标
57 | @param angle 旋转的角度
58 | @return CGAffineTransform对象
59 | */
60 | - (CGAffineTransform)GetCGAffineTransformRotateAroundCenterX:(float)centerX centerY:(float)centerY x:(float)x y:(float)y angle:(float)angle{
61 |
62 | CGFloat l = y - centerY;
63 | CGFloat h = l * sin(angle);
64 | CGFloat b = l * cos(angle);
65 | CGFloat a = l - b;
66 | CGFloat x1 = h;
67 | CGFloat y1 = a;
68 |
69 | CGAffineTransform trans = CGAffineTransformMakeTranslation(x1, y1);
70 | trans = CGAffineTransformRotate(trans,angle);
71 |
72 | return trans;
73 | }
74 |
75 | @end
76 |
77 |
78 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKugouSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKugouSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKugouSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKugouSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKugouSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKugouSecondVC.h"
10 |
11 | @interface LYNavKugouSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYNavKugouSecondVC
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | self.title = @"KuGouSecond";
22 | self.view.backgroundColor = [UIColor blackColor];
23 |
24 | UIImage *image = [UIImage imageNamed:@"kugoou"];
25 | CGSize size = [self backImageSize:image];
26 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
27 | _imgView.image = image;
28 | _imgView.userInteractionEnabled = YES;
29 | [self.view addSubview:_imgView];
30 | }
31 |
32 | - (CGSize)backImageSize:(UIImage *)image{
33 |
34 | CGSize size = image.size;
35 | CGSize newSize;
36 | newSize.width = kScreenWidth;
37 | newSize.height = newSize.width / size.width * size.height;
38 |
39 | return newSize;
40 | }
41 | - (void)didReceiveMemoryWarning {
42 | [super didReceiveMemoryWarning];
43 | // Dispose of any resources that can be recreated.
44 | }
45 |
46 | @end
47 |
48 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKugouVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKugouVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavKugouVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-KuGouTransiton/LYNavKugouVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavImitateKugouVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavKugouVC.h"
10 | #import "LYNavKugouSecondVC.h"
11 | #import "LYNavKuGouAnimationTransition.h"
12 |
13 | @interface LYNavKugouVC ()
14 |
15 | @property (nonatomic, strong) LYNavKuGouAnimationTransition *animatedTransition;
16 |
17 | @property (nonatomic, strong) UIImageView *imgView;
18 |
19 | @end
20 |
21 | @implementation LYNavKugouVC
22 |
23 | - (void)viewDidDisappear:(BOOL)animated{
24 | [super viewDidDisappear:animated];
25 | }
26 | - (void)viewDidAppear:(BOOL)animated{
27 | [super viewDidAppear:animated];
28 |
29 | self.animatedTransition = nil;
30 | self.navigationController.delegate = nil;
31 | }
32 | - (void)viewWillDisappear:(BOOL)animated{
33 | [super viewWillDisappear:animated];
34 | }
35 | - (void)viewWillAppear:(BOOL)animated{
36 | [super viewWillAppear:animated];
37 | }
38 |
39 | - (void)viewDidLoad {
40 | [super viewDidLoad];
41 | self.title = @"KuGou";
42 | self.view.backgroundColor = bgColor;
43 |
44 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
45 | _imgView.center = self.view.center;
46 | _imgView.image = [UIImage imageNamed:@"kugoou"];
47 | _imgView.userInteractionEnabled = YES;
48 | [self.view addSubview:_imgView];
49 |
50 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
51 | [_imgView addGestureRecognizer:tap];
52 | }
53 |
54 | - (void)pushSecond{
55 |
56 | //1. 设置代理
57 | self.animatedTransition = nil;
58 | self.navigationController.delegate = self.animatedTransition;
59 |
60 | //2.push跳转
61 | LYNavKugouSecondVC *second = [[LYNavKugouSecondVC alloc] init];
62 | [self.navigationController pushViewController:second animated:YES];
63 | }
64 |
65 |
66 | - (LYNavKuGouAnimationTransition *)animatedTransition{
67 | if (!_animatedTransition) {
68 | _animatedTransition = [[LYNavKuGouAnimationTransition alloc] init];
69 | }
70 | return _animatedTransition;
71 | }
72 |
73 | - (void)didReceiveMemoryWarning {
74 | [super didReceiveMemoryWarning];
75 | // Dispose of any resources that can be recreated.
76 | }
77 |
78 | /*
79 | #pragma mark - Navigation
80 |
81 | // In a storyboard-based application, you will often want to do a little preparation before navigation
82 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
83 | // Get the new view controller using [segue destinationViewController].
84 | // Pass the selected object to the new view controller.
85 | }
86 | */
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatInteractiveAnimatedTransition : NSObject
12 |
13 | /** 转场过渡的图片 */
14 | - (void)setTransitionImgView:(UIImageView *)transitionImgView;
15 |
16 | /** 转场前的图片frame */
17 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
18 |
19 | /** 转场后的图片frame */
20 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
21 |
22 |
23 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
24 | @property (nonatomic, assign) CGRect currentImageViewFrame; //当前图片的frame
25 | @property (nonatomic, strong) UIImageView *currentImageView; //当前图片
26 |
27 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractivePopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatInteractivePopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatInteractivePopAnimator : NSObject
12 |
13 | @property (nonatomic, strong) UIImageView *transitionImgView;
14 |
15 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
16 |
17 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractivePushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatInteractivePushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatInteractivePushAnimator : NSObject
12 |
13 | @property (nonatomic, strong) UIImageView *transitionImgView;
14 |
15 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
16 |
17 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractivePushAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatInteractivePushAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavWeChatInteractivePushAnimator.h"
10 |
11 | @implementation LYNavWeChatInteractivePushAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.5;
15 | }
16 | - (void)animateTransition:(id)transitionContext{
17 |
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //FromVC
22 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
23 | UIView *fromView = fromViewController.view;
24 | [containerView addSubview:fromView];
25 |
26 | //ToVC
27 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
28 | UIView *toView = toViewController.view;
29 | [containerView addSubview:toView];
30 | toView.hidden = YES;
31 |
32 | //图片背景的空白view (设置和控制器的背景颜色一样,给人一种图片被调走的假象 [可以换种颜色看看效果])
33 | UIView *imgBgWhiteView = [[UIView alloc] initWithFrame:self.transitionBeforeImgFrame];
34 | imgBgWhiteView.backgroundColor = bgColor;
35 | [containerView addSubview:imgBgWhiteView];
36 |
37 | //有渐变的黑色背景
38 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
39 | bgView.backgroundColor = [UIColor blackColor];
40 | bgView.alpha = 0;
41 | [containerView addSubview:bgView];
42 |
43 | //过渡的图片
44 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionImgView.image];
45 | transitionImgView.frame = self.transitionBeforeImgFrame;
46 | [transitionContext.containerView addSubview:transitionImgView];
47 |
48 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveLinear animations:^{
49 |
50 | transitionImgView.frame = self.transitionAfterImgFrame;
51 | bgView.alpha = 1;
52 |
53 | } completion:^(BOOL finished) {
54 |
55 | toView.hidden = NO;
56 |
57 | [imgBgWhiteView removeFromSuperview];
58 | [bgView removeFromSuperview];
59 | [transitionImgView removeFromSuperview];
60 |
61 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
62 | //设置transitionContext通知系统动画执行完毕
63 | [transitionContext completeTransition:!wasCancelled];
64 | }];
65 |
66 | }
67 |
68 | @end
69 |
70 |
71 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractiveSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYWeChatInteractiveSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatInteractiveSecondVC : UIViewController
12 |
13 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatInteractiveVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatInteractiveVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatInteractiveVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChat-InteractiveTransition/LYNavWeChatPercentDrivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatPercentDrivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/23.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatPercentDrivenInteractive : UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer*)gestureRecognizer;
14 |
15 | @property (nonatomic, assign) CGRect beforeImageViewFrame; //图片的frame
16 | @property (nonatomic, assign) CGRect currentImageViewFrame; //当前图片的frame
17 | @property (nonatomic, strong) UIImageView *currentImageView; //当前图片
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatAnimationTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatAnimationTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavWeChatAnimationTransition : NSObject
13 |
14 | /** 转场过渡的图片 */
15 | - (void)setTransitionImgView:(UIImageView *)transitionImgView;
16 | /** 转场前的图片frame */
17 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
18 | /** 转场后的图片frame */
19 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatAnimationTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatAnimationTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavWeChatAnimationTransition.h"
10 | #import "LYNavWeChatPushAnimator.h"
11 | #import "LYNavWeChatPopAnimator.h"
12 | @interface LYNavWeChatAnimationTransition ()
13 |
14 | @property (nonatomic, strong) LYNavWeChatPushAnimator *customPush;
15 | @property (nonatomic, strong) LYNavWeChatPopAnimator *customPop;
16 |
17 | @end
18 |
19 | @implementation LYNavWeChatAnimationTransition
20 |
21 | /** 转场过渡的图片 */
22 | - (void)setTransitionImgView:(UIImageView *)transitionImgView{
23 | self.customPush.transitionImgView = transitionImgView;
24 | self.customPop.transitionImgView = transitionImgView;
25 | }
26 |
27 | /** 转场前的图片frame */
28 | - (void)setTransitionBeforeImgFrame:(CGRect)frame{
29 | self.customPop.transitionBeforeImgFrame = frame;
30 | self.customPush.transitionBeforeImgFrame = frame;
31 | }
32 |
33 | /** 转场后的图片frame */
34 | - (void)setTransitionAfterImgFrame:(CGRect)frame{
35 | self.customPush.transitionAfterImgFrame = frame;
36 | self.customPop.transitionAfterImgFrame = frame;
37 | }
38 |
39 |
40 | - (nullable id )navigationController:(UINavigationController *)navigationController
41 | animationControllerForOperation:(UINavigationControllerOperation)operation
42 | fromViewController:(UIViewController *)fromVC
43 | toViewController:(UIViewController *)toVC{
44 | if (operation == UINavigationControllerOperationPush) {
45 | return self.customPush;
46 |
47 | }else if (operation == UINavigationControllerOperationPop){
48 | return self.customPop;
49 | }
50 | return nil;
51 | }
52 |
53 | - (LYNavWeChatPushAnimator *)customPush{
54 | if (_customPush == nil) {
55 | _customPush = [[LYNavWeChatPushAnimator alloc]init];
56 | }
57 | return _customPush;
58 | }
59 |
60 | - (LYNavWeChatPopAnimator *)customPop{
61 | if (!_customPop) {
62 | _customPop = [[LYNavWeChatPopAnimator alloc] init];
63 | }
64 | return _customPop;
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatPopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatPopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatPopAnimator : NSObject
12 |
13 | @property (nonatomic, strong) UIImageView *transitionImgView;
14 |
15 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
16 |
17 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatPopAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatPopAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavWeChatPopAnimator.h"
10 |
11 | @implementation LYNavWeChatPopAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.5;
15 | }
16 | - (void)animateTransition:(id)transitionContext{
17 |
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //ToVC
22 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
23 | UIView *toView = toViewController.view;
24 | [containerView addSubview:toView];
25 |
26 | //图片背景的空白view (设置和控制器的背景颜色一样,给人一种图片被调走的假象)
27 | UIView *imgBgWhiteView = [[UIView alloc] initWithFrame:self.transitionBeforeImgFrame];
28 | imgBgWhiteView.backgroundColor = bgColor;
29 | [containerView addSubview:imgBgWhiteView];
30 |
31 | //有渐变的黑色背景
32 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
33 | bgView.backgroundColor = [UIColor blackColor];
34 | bgView.alpha = 1;
35 | [containerView addSubview:bgView];
36 |
37 | //过渡的图片
38 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionImgView.image];
39 | transitionImgView.frame = self.transitionAfterImgFrame;
40 | [transitionContext.containerView addSubview:transitionImgView];
41 |
42 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveLinear animations:^{
43 |
44 | transitionImgView.frame = self.transitionBeforeImgFrame;
45 | bgView.alpha = 0;
46 |
47 | } completion:^(BOOL finished) {
48 |
49 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
50 |
51 | [imgBgWhiteView removeFromSuperview];
52 | [bgView removeFromSuperview];
53 | [transitionImgView removeFromSuperview];
54 |
55 | //设置transitionContext通知系统动画执行完毕
56 | [transitionContext completeTransition:!wasCancelled];
57 | }];
58 | }
59 |
60 | @end
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatPushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatPushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYNavWeChatPushAnimator : NSObject
13 |
14 | @property (nonatomic, strong) UIImageView *transitionImgView; //转场图片
15 |
16 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
17 |
18 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatPushAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatPushAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavWeChatPushAnimator.h"
10 |
11 | @implementation LYNavWeChatPushAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.5;
15 | }
16 | - (void)animateTransition:(id)transitionContext{
17 |
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //FromVC
22 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
23 | UIView *fromView = fromViewController.view;
24 | [containerView addSubview:fromView];
25 |
26 | //ToVC
27 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
28 | UIView *toView = toViewController.view;
29 | [containerView addSubview:toView];
30 | toView.hidden = YES;
31 |
32 | //图片背景的空白view (设置和控制器的背景颜色一样,给人一种图片被调走的假象 [可以换种颜色看看效果])
33 | UIView *imgBgWhiteView = [[UIView alloc] initWithFrame:self.transitionBeforeImgFrame];
34 | imgBgWhiteView.backgroundColor = bgColor;
35 | [containerView addSubview:imgBgWhiteView];
36 |
37 | //有渐变的黑色背景
38 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
39 | bgView.backgroundColor = [UIColor blackColor];
40 | bgView.alpha = 0;
41 | [containerView addSubview:bgView];
42 |
43 | //过渡的图片
44 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionImgView.image];
45 | transitionImgView.frame = self.transitionBeforeImgFrame;
46 | [transitionContext.containerView addSubview:transitionImgView];
47 |
48 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveLinear animations:^{
49 |
50 | transitionImgView.frame = self.transitionAfterImgFrame;
51 | bgView.alpha = 1;
52 |
53 | } completion:^(BOOL finished) {
54 |
55 | toView.hidden = NO;
56 |
57 | [imgBgWhiteView removeFromSuperview];
58 | [bgView removeFromSuperview];
59 | [transitionImgView removeFromSuperview];
60 |
61 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
62 | //设置transitionContext通知系统动画执行完毕
63 | [transitionContext completeTransition:!wasCancelled];
64 | }];
65 |
66 | }
67 |
68 | @end
69 |
70 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYNavWeChatSecondVC.h"
10 |
11 | @interface LYNavWeChatSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYNavWeChatSecondVC
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 |
22 | self.title = @"WeChatSecond";
23 | self.view.backgroundColor = [UIColor blackColor];
24 |
25 | UIImage *image = [UIImage imageNamed:@"wechat.jpg"];
26 | CGSize size = [self backImageSize:image];
27 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, (kScreenHeight - size.height) * 0.5, size.width, size.height)];
28 | _imgView.image = image;
29 | _imgView.userInteractionEnabled = YES;
30 | [self.view addSubview:_imgView];
31 | }
32 |
33 | - (CGSize)backImageSize:(UIImage *)image{
34 |
35 | CGSize size = image.size;
36 | CGSize newSize;
37 | newSize.width = kScreenWidth;
38 | newSize.height = newSize.width / size.width * size.height;
39 |
40 | return newSize;
41 | }
42 |
43 | - (void)didReceiveMemoryWarning {
44 | [super didReceiveMemoryWarning];
45 | // Dispose of any resources that can be recreated.
46 | }
47 |
48 | /*
49 | #pragma mark - Navigation
50 |
51 | // In a storyboard-based application, you will often want to do a little preparation before navigation
52 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
53 | // Get the new view controller using [segue destinationViewController].
54 | // Pass the selected object to the new view controller.
55 | }
56 | */
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Navigation-Transition/Nav-WeChatTransiton/LYNavWeChatVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYNavWeChatVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYNavWeChatVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Net-Friends-Questions/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionOneCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionOneCell.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol LYFourTableViewCellDelegate
12 |
13 | - (void)imageViewTapClick:(NSInteger)cellIndex;
14 |
15 | @end
16 |
17 | @interface LYQuestionOneCell : UITableViewCell
18 |
19 | @property (nonatomic, strong) UIImageView *imgView;
20 |
21 | @property (nonatomic, assign) CGFloat cellHeight;
22 |
23 | @property (nonatomic, assign) NSInteger cellIndex;
24 |
25 | @property (nonatomic, weak) id delegate;
26 |
27 | - (void)setImageForImgView:(UIImage *)image;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionOneCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionOneCell.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionOneCell.h"
10 |
11 | @implementation LYQuestionOneCell
12 |
13 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
14 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
15 | if (self) {
16 | [self creatUI];
17 | }
18 | return self;
19 | }
20 |
21 | - (void)creatUI{
22 | self.backgroundColor = [UIColor colorWithRed:0.1 green:0.7 blue:0.4 alpha:1];
23 |
24 | // UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)];
25 | // [self.contentView addGestureRecognizer:tap];
26 |
27 | _imgView = [[UIImageView alloc] init];
28 | _imgView.contentMode = UIViewContentModeScaleAspectFit;
29 | _imgView.backgroundColor = [UIColor redColor];
30 | [self.contentView addSubview:_imgView];
31 | }
32 |
33 | - (void)setImageForImgView:(UIImage *)image{
34 | CGSize size = [self backImageNewSize:image.size];
35 | _imgView.frame = CGRectMake(16, 0, size.width, size.height);
36 | _imgView.image = image;
37 | _cellHeight = size.height + 40;
38 | }
39 |
40 | - (CGSize)backImageNewSize:(CGSize)size{
41 |
42 | CGSize newSize;
43 | newSize.height = 200;
44 | newSize.width = newSize.height / size.height * size.width;
45 |
46 | return newSize;
47 | }
48 | - (void)tapClick{
49 | if (_delegate && [_delegate respondsToSelector:@selector(imageViewTapClick:)]) {
50 | [_delegate imageViewTapClick:_cellIndex];
51 | }
52 | }
53 |
54 | @end
55 |
56 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOneAnimationTrasition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOneAnimationTrasition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionsOneAnimationTrasition : NSObject
13 |
14 | /** 转场过渡的图片 */
15 | - (void)setTransitionImgView:(UIImageView *)transitionImgView;
16 | /** 转场前的图片frame */
17 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
18 | /** 转场后的图片frame */
19 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOneAnimationTrasition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOneAnimationTrasition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionsOneAnimationTrasition.h"
10 | #import "LYQuestionsOnePopAnimator.h"
11 | #import "LYQuestionsOnePushAnimator.h"
12 |
13 | @interface LYQuestionsOneAnimationTrasition ()
14 |
15 | @property (nonatomic, strong) LYQuestionsOnePushAnimator *customPush;
16 | @property (nonatomic, strong) LYQuestionsOnePopAnimator *customPop;
17 |
18 | @end
19 |
20 | @implementation LYQuestionsOneAnimationTrasition
21 |
22 | /** 转场过渡的图片 */
23 | - (void)setTransitionImgView:(UIImageView *)transitionImgView{
24 | self.customPush.transitionImgView = transitionImgView;
25 | self.customPop.transitionImgView = transitionImgView;
26 | }
27 |
28 | /** 转场前的图片frame */
29 | - (void)setTransitionBeforeImgFrame:(CGRect)frame{
30 | self.customPop.transitionBeforeImgFrame = frame;
31 | self.customPush.transitionBeforeImgFrame = frame;
32 | }
33 |
34 | /** 转场后的图片frame */
35 | - (void)setTransitionAfterImgFrame:(CGRect)frame{
36 | self.customPush.transitionAfterImgFrame = frame;
37 | self.customPop.transitionAfterImgFrame = frame;
38 | }
39 |
40 |
41 | - (nullable id )navigationController:(UINavigationController *)navigationController
42 | animationControllerForOperation:(UINavigationControllerOperation)operation
43 | fromViewController:(UIViewController *)fromVC
44 | toViewController:(UIViewController *)toVC{
45 | if (operation == UINavigationControllerOperationPush) {
46 | return self.customPush;
47 |
48 | }else if (operation == UINavigationControllerOperationPop){
49 | return self.customPop;
50 | }
51 | return nil;
52 | }
53 |
54 | - (LYQuestionsOnePushAnimator *)customPush{
55 | if (_customPush == nil) {
56 | _customPush = [[LYQuestionsOnePushAnimator alloc]init];
57 | }
58 | return _customPush;
59 | }
60 |
61 | - (LYQuestionsOnePopAnimator *)customPop{
62 | if (!_customPop) {
63 | _customPop = [[LYQuestionsOnePopAnimator alloc] init];
64 | }
65 | return _customPop;
66 | }
67 |
68 | @end
69 |
70 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOneFirstVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOneFirstVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYQuestionsOneFirstVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOnePopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOnePopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionsOnePopAnimator : NSObject
13 |
14 | @property (nonatomic, strong) UIImageView *transitionImgView;
15 |
16 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
17 |
18 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOnePopAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOnePopAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionsOnePopAnimator.h"
10 |
11 | @implementation LYQuestionsOnePopAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.3;
15 | }
16 | - (void)animateTransition:(id)transitionContext{
17 |
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //ToVC
22 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
23 | UIView *toView = toViewController.view;
24 | [containerView addSubview:toView];
25 |
26 | //图片背景的空白view (设置和控制器的背景颜色一样,给人一种图片被调走的假象)
27 | UIView *imgBgWhiteView = [[UIView alloc] initWithFrame:self.transitionBeforeImgFrame];
28 | imgBgWhiteView.backgroundColor = bgColor;
29 | [containerView addSubview:imgBgWhiteView];
30 |
31 | //有渐变的白色背景
32 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
33 | bgView.backgroundColor = [UIColor whiteColor];
34 | bgView.alpha = 1;
35 | [containerView addSubview:bgView];
36 |
37 | //过渡的图片
38 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionImgView.image];
39 | transitionImgView.frame = self.transitionAfterImgFrame;
40 | [transitionContext.containerView addSubview:transitionImgView];
41 |
42 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveLinear animations:^{
43 |
44 | transitionImgView.frame = self.transitionBeforeImgFrame;
45 | bgView.alpha = 0;
46 |
47 | } completion:^(BOOL finished) {
48 |
49 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
50 |
51 | [imgBgWhiteView removeFromSuperview];
52 | [bgView removeFromSuperview];
53 | [transitionImgView removeFromSuperview];
54 |
55 | //设置transitionContext通知系统动画执行完毕
56 | [transitionContext completeTransition:!wasCancelled];
57 | }];
58 |
59 | }
60 |
61 | @end
62 |
63 |
64 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOnePushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOnePushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionsOnePushAnimator : NSObject
13 |
14 | @property (nonatomic, strong) UIImageView *transitionImgView;
15 |
16 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
17 |
18 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOnePushAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOnePushAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/16.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionsOnePushAnimator.h"
10 |
11 | @implementation LYQuestionsOnePushAnimator
12 |
13 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
14 | return 0.5;
15 | }
16 | - (void)animateTransition:(id)transitionContext{
17 |
18 | //转场过渡的容器view
19 | UIView *containerView = [transitionContext containerView];
20 |
21 | //FromVC
22 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
23 | UIView *fromView = fromViewController.view;
24 | [containerView addSubview:fromView];
25 |
26 | //ToVC
27 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
28 | UIView *toView = toViewController.view;
29 | [containerView addSubview:toView];
30 | toView.alpha = 0;
31 |
32 | //过渡的图片
33 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionImgView.image];
34 | transitionImgView.frame = self.transitionBeforeImgFrame;
35 | [transitionContext.containerView addSubview:transitionImgView];
36 |
37 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveLinear animations:^{
38 |
39 | transitionImgView.frame = self.transitionAfterImgFrame;
40 |
41 | toView.alpha = 1;
42 |
43 | } completion:^(BOOL finished) {
44 |
45 | [transitionImgView removeFromSuperview];
46 |
47 | BOOL wasCancelled = [transitionContext transitionWasCancelled];
48 | //设置transitionContext通知系统动画执行完毕
49 | [transitionContext completeTransition:!wasCancelled];
50 | }];
51 |
52 | }
53 |
54 | @end
55 |
56 |
57 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOneSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOneSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYQuestionsOneSecondVC : UIViewController
12 |
13 | @property (nonatomic, strong) UIImage *image;
14 | @property (nonatomic, assign) CGRect imgFrame;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-one/LYQuestionsOneSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionsOneSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionsOneSecondVC.h"
10 |
11 | @interface LYQuestionsOneSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYQuestionsOneSecondVC
18 |
19 | - (void)viewWillDisappear:(BOOL)animated{
20 | _imgView.hidden = YES;
21 | self.navigationController.navigationBarHidden = NO;
22 |
23 | [super viewWillDisappear:animated];
24 | }
25 | - (void)viewWillAppear:(BOOL)animated{
26 | [super viewWillAppear:animated];
27 | self.navigationController.navigationBarHidden = YES;
28 | }
29 |
30 | - (void)viewDidLoad {
31 | [super viewDidLoad];
32 |
33 | self.title = @"WeChatSecond";
34 | self.view.backgroundColor = [UIColor whiteColor];
35 |
36 | _imgView = [[UIImageView alloc] initWithFrame:self.imgFrame];
37 | _imgView.image = self.image;
38 | _imgView.userInteractionEnabled = YES;
39 | [self.view addSubview:_imgView];
40 |
41 | //返回按钮
42 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, 60, 44)];
43 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
44 | [button setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
45 | [button addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
46 | [self.view addSubview:button];
47 |
48 | //其他
49 | CGFloat labelY = CGRectGetMaxY(self.imgView.frame) + 10;
50 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, labelY, kScreenWidth - 20, kScreenHeight - labelY - 10)];
51 | label.numberOfLines = 0;
52 | label.text = @"测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据测试数据";
53 | [self.view addSubview:label];
54 | }
55 |
56 | - (void)backBtnClick:(UIButton *)sender{
57 | [self.navigationController popViewControllerAnimated:YES];
58 | }
59 |
60 |
61 | - (void)didReceiveMemoryWarning {
62 | [super didReceiveMemoryWarning];
63 | // Dispose of any resources that can be recreated.
64 | }
65 |
66 | /*
67 | #pragma mark - Navigation
68 |
69 | // In a storyboard-based application, you will often want to do a little preparation before navigation
70 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
71 | // Get the new view controller using [segue destinationViewController].
72 | // Pass the selected object to the new view controller.
73 | }
74 | */
75 |
76 | @end
77 |
78 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoAnimationTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoAnimationTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by kurt lee on 2017/12/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionTwoAnimationTransition : NSObject
13 |
14 | /** 转场过渡的图片 */
15 | - (void)setTransitionImg:(UIImage *)transitionImg;
16 | /** 转场过渡的图片 */
17 | - (void)setFlipImg:(UIImage *)flipImg;
18 |
19 | /** 转场前的图片frame */
20 | - (void)setTransitionBeforeImgFrame:(CGRect)frame;
21 | /** 转场后的图片frame */
22 | - (void)setTransitionAfterImgFrame:(CGRect)frame;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoAnimationTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoAnimationTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by kurt lee on 2017/12/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionTwoAnimationTransition.h"
10 | #import "LYQuestionTwoPushAnimator.h"
11 | #import "LYQuestionTwoPopAnimator.h"
12 |
13 | @interface LYQuestionTwoAnimationTransition ()
14 |
15 | @property (nonatomic, strong) LYQuestionTwoPushAnimator *customPush;
16 | @property (nonatomic, strong) LYQuestionTwoPopAnimator *customPop;
17 |
18 | @end
19 |
20 | @implementation LYQuestionTwoAnimationTransition
21 |
22 | /** 转场过渡的图片 */
23 | - (void)setTransitionImg:(UIImage *)transitionImg{
24 | self.customPush.transitionImg = transitionImg;
25 | self.customPop.transitionImg = transitionImg;
26 | }
27 | - (void)setFlipImg:(UIImage *)flipImg{
28 | self.customPush.flipImg = flipImg;
29 | self.customPop.flipImg = flipImg;
30 | }
31 | /** 转场前的图片frame */
32 | - (void)setTransitionBeforeImgFrame:(CGRect)frame{
33 | self.customPop.transitionBeforeImgFrame = frame;
34 | self.customPush.transitionBeforeImgFrame = frame;
35 | }
36 |
37 | /** 转场后的图片frame */
38 | - (void)setTransitionAfterImgFrame:(CGRect)frame{
39 | self.customPush.transitionAfterImgFrame = frame;
40 | self.customPop.transitionAfterImgFrame = frame;
41 | }
42 |
43 |
44 | - (nullable id )navigationController:(UINavigationController *)navigationController
45 | animationControllerForOperation:(UINavigationControllerOperation)operation
46 | fromViewController:(UIViewController *)fromVC
47 | toViewController:(UIViewController *)toVC{
48 | if (operation == UINavigationControllerOperationPush) {
49 | return self.customPush;
50 |
51 | }else if (operation == UINavigationControllerOperationPop){
52 | return self.customPop;
53 | }
54 | return nil;
55 | }
56 |
57 | - (LYQuestionTwoPushAnimator *)customPush{
58 | if (_customPush == nil) {
59 | _customPush = [[LYQuestionTwoPushAnimator alloc]init];
60 | }
61 | return _customPush;
62 | }
63 |
64 | - (LYQuestionTwoPopAnimator *)customPop{
65 | if (!_customPop) {
66 | _customPop = [[LYQuestionTwoPopAnimator alloc] init];
67 | }
68 | return _customPop;
69 | }
70 |
71 | @end
72 |
73 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoFirstVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoFirstVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYQuestionTwoFirstVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoFirstVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoFirstVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionTwoFirstVC.h"
10 | #import "LYQuestionTwoAnimationTransition.h"
11 | #import "LYQuestionTwoSecondVC.h"
12 |
13 | @interface LYQuestionTwoFirstVC ()
14 |
15 | @property (nonatomic, strong) LYQuestionTwoAnimationTransition *animatedTransition;
16 |
17 | @property (nonatomic, strong) UIImageView *flipView;
18 | @property (nonatomic, strong) UIImageView *imgView;
19 |
20 | @end
21 |
22 | @implementation LYQuestionTwoFirstVC
23 |
24 | - (void)viewDidAppear:(BOOL)animated{
25 | [super viewDidAppear:animated];
26 |
27 | self.animatedTransition = nil;
28 | self.navigationController.delegate = nil;
29 | }
30 | - (void)viewDidLoad {
31 | [super viewDidLoad];
32 | self.title = @"QuestionTwo";
33 | self.view.backgroundColor = bgColor;
34 |
35 | UIImage *img = [UIImage imageNamed:@"flip"];
36 | CGSize size;
37 | size.height = 120;
38 | size.width = size.height / img.size.height * img.size.width;
39 |
40 | _imgView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 100, size.width, size.height)];
41 | _imgView.image = img;
42 | _imgView.userInteractionEnabled = YES;
43 | [self.view addSubview:_imgView];
44 |
45 |
46 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSecond)];
47 | [_imgView addGestureRecognizer:tap];
48 | }
49 |
50 | - (void)pushSecond{
51 | //1. 设置代理
52 | self.animatedTransition = nil;
53 | self.navigationController.delegate = self.animatedTransition;
54 |
55 |
56 | UIImage *contentImg = [UIImage imageNamed:@"content"];
57 | //2. 传入必要的3个参数
58 | [self.animatedTransition setTransitionImg:contentImg];
59 | [self.animatedTransition setTransitionBeforeImgFrame:_imgView.frame];
60 |
61 | [self.animatedTransition setFlipImg:_imgView.image];
62 |
63 | //3.push跳转
64 | LYQuestionTwoSecondVC *second = [[LYQuestionTwoSecondVC alloc] init];
65 | [self.navigationController pushViewController:second animated:YES];
66 | }
67 |
68 | - (LYQuestionTwoAnimationTransition *)animatedTransition{
69 | if (!_animatedTransition) {
70 | _animatedTransition = [[LYQuestionTwoAnimationTransition alloc] init];
71 | }
72 | return _animatedTransition;
73 | }
74 |
75 | @end
76 |
77 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoPopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoPopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by kurt lee on 2017/12/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionTwoPopAnimator : NSObject
13 |
14 | @property (nonatomic, strong) UIImage *transitionImg;
15 | @property (nonatomic, strong) UIImage *flipImg; //翻转的图片
16 |
17 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
18 |
19 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoPushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoPushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by kurt lee on 2017/12/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYQuestionTwoPushAnimator : NSObject
13 |
14 | @property (nonatomic, strong) UIImage *transitionImg; //转场图片
15 | @property (nonatomic, strong) UIImage *flipImg; //翻转的图片
16 |
17 |
18 | @property (nonatomic, assign) CGRect transitionBeforeImgFrame; //转场前图片的frame
19 |
20 | @property (nonatomic, assign) CGRect transitionAfterImgFrame; //转场后图片的frame
21 |
22 | @end
23 |
24 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoSecondVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoSecondVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by 李阳 on 2017/6/15.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYQuestionTwoSecondVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Net-Friends-Questions/Questions-two/LYQuestionTwoSecondVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYQuestionTwoSecondVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by kurt lee on 2017/12/13.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYQuestionTwoSecondVC.h"
10 |
11 | @interface LYQuestionTwoSecondVC ()
12 |
13 | @property (nonatomic, strong) UIImageView *imgView;
14 |
15 | @end
16 |
17 | @implementation LYQuestionTwoSecondVC
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 |
22 | self.title = @"QuestionTwoSecond";
23 | self.view.backgroundColor = [UIColor blackColor];
24 |
25 | UIImage *image = [UIImage imageNamed:@"content"];
26 | _imgView = [[UIImageView alloc] initWithFrame:self.view.bounds];
27 | _imgView.image = image;
28 | _imgView.userInteractionEnabled = YES;
29 | [self.view addSubview:_imgView];
30 | }
31 |
32 | - (void)didReceiveMemoryWarning {
33 | [super didReceiveMemoryWarning];
34 | // Dispose of any resources that can be recreated.
35 | }
36 |
37 | /*
38 | #pragma mark - Navigation
39 |
40 | // In a storyboard-based application, you will often want to do a little preparation before navigation
41 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
42 | // Get the new view controller using [segue destinationViewController].
43 | // Pass the selected object to the new view controller.
44 | }
45 | */
46 |
47 | @end
48 |
49 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/PictureBrowse/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Controller/LYPictureBrowseViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseViewController.h
3 | // FollowMe
4 | //
5 | // Created by liyang on 16/10/12.
6 | // Copyright © 2016年 FM. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LYPictureBrowseInteractiveAnimatedTransition.h"
11 |
12 | #define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
13 | #define SCREENHEIGHT ([UIScreen mainScreen].bounds.size.height)
14 |
15 | //图片浏览器中图片之间的水平间距
16 | #define kBrowseSpace 50.0f
17 |
18 | @class LYPictureBrowseSouceModel;
19 |
20 | @interface LYPictureBrowseViewController : UIViewController
21 |
22 | @property (nonatomic, strong) LYPictureBrowseInteractiveAnimatedTransition *animatedTransition;
23 |
24 | @property (nonatomic, strong) NSArray *dataSouceArray;
25 |
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/LYPictureBrowse.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowse.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/11.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #ifndef LYPictureBrowse_h
10 | #define LYPictureBrowse_h
11 |
12 | #import "LYPictureBrowseViewController.h"
13 | #import "LYPictureBrowseSouceModel.h"
14 | #import "LYPictureBrowseInteractiveAnimatedTransition.h"
15 | #import "LYPictureBrowseTransitionParameter.h"
16 |
17 | #endif /* LYPictureBrowse_h */
18 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Model/LYPictureBrowseSouceModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseSouceModel.h
3 | // FollowMe
4 | //
5 | // Created by liyang on 16/10/12.
6 | // Copyright © 2016年 FM. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface LYPictureBrowseSouceModel : NSObject
13 |
14 | @property (nonatomic, strong) NSString *imgUrl;
15 |
16 | @property (nonatomic, strong) NSString *imgUrl_thumb;
17 |
18 | @property (nonatomic, strong) UIImage *image;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Model/LYPictureBrowseSouceModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureFirstVC.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureBrowseSouceModel.h"
10 |
11 | @implementation LYPictureBrowseSouceModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowseInteractiveAnimatedTransition.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseInteractiveAnimatedTransition.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LYPictureBrowseTransitionParameter.h"
11 |
12 | @interface LYPictureBrowseInteractiveAnimatedTransition : NSObject
13 |
14 | @property (nonatomic, strong) LYPictureBrowseTransitionParameter *transitionParameter;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowseInteractiveAnimatedTransition.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseInteractiveAnimatedTransition.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureBrowseInteractiveAnimatedTransition.h"
10 | #import "LYPictureBrowsePercentDrivenInteractive.h"
11 | #import "LYPictureBrowsePushAnimator.h"
12 | #import "LYPictureBrowsePopAnimator.h"
13 |
14 | @interface LYPictureBrowseInteractiveAnimatedTransition ()
15 |
16 | @property (nonatomic, strong) LYPictureBrowsePushAnimator *customPush;
17 | @property (nonatomic, strong) LYPictureBrowsePopAnimator *customPop;
18 | @property (nonatomic, strong) LYPictureBrowsePercentDrivenInteractive *percentIntractive;
19 |
20 | @end
21 |
22 | @implementation LYPictureBrowseInteractiveAnimatedTransition
23 |
24 | - (nullable id )animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
25 | return self.customPush;
26 | }
27 |
28 | - (nullable id )animationControllerForDismissedController:(UIViewController *)dismissed{
29 | return self.customPop;
30 | }
31 |
32 | - (nullable id )interactionControllerForPresentation:(id )animator{
33 |
34 | return nil;//push时不加手势交互
35 | }
36 | - (nullable id )interactionControllerForDismissal:(id )animator{
37 | if (self.transitionParameter.gestureRecognizer)
38 | return self.percentIntractive;
39 | else
40 | return nil;
41 |
42 | }
43 |
44 | -(LYPictureBrowsePushAnimator *)customPush
45 | {
46 | if (_customPush == nil) {
47 | _customPush = [[LYPictureBrowsePushAnimator alloc]init];
48 | }
49 | return _customPush;
50 | }
51 |
52 | - (LYPictureBrowsePopAnimator *)customPop {
53 | if (!_customPop) {
54 | _customPop = [[LYPictureBrowsePopAnimator alloc] init];
55 | }
56 | return _customPop;
57 | }
58 | - (LYPictureBrowsePercentDrivenInteractive *)percentIntractive{
59 | if (!_percentIntractive) {
60 | _percentIntractive = [[LYPictureBrowsePercentDrivenInteractive alloc] initWithTransitionParameter:self.transitionParameter];
61 | }
62 | return _percentIntractive;
63 | }
64 |
65 | -(void)setTransitionParameter:(LYPictureBrowseTransitionParameter *)transitionParameter{
66 | _transitionParameter = transitionParameter;
67 |
68 | self.customPush.transitionParameter = transitionParameter;
69 | self.customPop.transitionParameter = transitionParameter;
70 | }
71 |
72 | @end
73 |
74 |
75 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowsePercentDrivenInteractive.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowsePercentDrivenInteractive.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class LYPictureBrowseTransitionParameter;
12 |
13 | @interface LYPictureBrowsePercentDrivenInteractive : UIPercentDrivenInteractiveTransition
14 |
15 | - (instancetype)initWithTransitionParameter:(LYPictureBrowseTransitionParameter*)transitionParameter;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowsePopAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowsePopAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
11 | #define SCREENHEIGHT ([UIScreen mainScreen].bounds.size.height)
12 |
13 | @class LYPictureBrowseTransitionParameter;
14 |
15 | @interface LYPictureBrowsePopAnimator : NSObject
16 |
17 | @property (nonatomic, strong) LYPictureBrowseTransitionParameter *transitionParameter;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowsePopAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowsePopAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureBrowsePopAnimator.h"
10 | #import "LYPictureBrowseTransitionParameter.h"
11 |
12 | @interface LYPictureBrowsePopAnimator ()
13 |
14 | @end
15 |
16 | @implementation LYPictureBrowsePopAnimator
17 |
18 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
19 | return 0.4;
20 | }
21 |
22 | - (void)animateTransition:(id)transitionContext{
23 |
24 | //转场过渡的容器view
25 | UIView *containerView = [transitionContext containerView];
26 |
27 | //ToVC
28 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
29 | [containerView addSubview:toViewController.view];
30 |
31 | //有渐变的黑色背景
32 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
33 | bgView.backgroundColor = [UIColor blackColor];
34 | bgView.alpha = 1;
35 | [containerView addSubview:bgView];
36 |
37 | CGRect fromFrame = self.transitionParameter.secondVCImgFrame;
38 | CGRect toFrame = [self.transitionParameter.firstVCImgFrames[self.transitionParameter.transitionImgIndex] CGRectValue];
39 |
40 | //过渡的图片
41 | UIView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionParameter.transitionImage];
42 | transitionImgView.layer.masksToBounds = YES;
43 | transitionImgView.contentMode = UIViewContentModeScaleAspectFill;
44 | transitionImgView.frame = fromFrame;
45 | [containerView addSubview:transitionImgView];
46 |
47 | //动画
48 | [UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0.0 usingSpringWithDamping:0.8 initialSpringVelocity:0.3 options:UIViewAnimationOptionCurveLinear animations:^{
49 | //避免frame数值都为零的处理
50 | CGRect imageFrame = toFrame;
51 | if (imageFrame.size.width == 0 && imageFrame.size.height == 0) {
52 | CGFloat defaultWidth = 5;
53 | imageFrame = CGRectMake((SCREENWIDTH - defaultWidth) * 0.5, (SCREENHEIGHT - defaultWidth) * 0.5, defaultWidth, defaultWidth);
54 | }
55 |
56 | transitionImgView.frame = imageFrame;
57 | bgView.alpha = 0;
58 |
59 | }completion:^(BOOL finished) {
60 | [bgView removeFromSuperview];
61 | [transitionImgView removeFromSuperview];
62 |
63 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
64 | }];
65 |
66 | }
67 |
68 | @end
69 |
70 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowsePushAnimator.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowsePushAnimator.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class LYPictureBrowseTransitionParameter;
12 |
13 | @interface LYPictureBrowsePushAnimator : NSObject
14 |
15 | @property (nonatomic, strong) LYPictureBrowseTransitionParameter *transitionParameter;
16 |
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowsePushAnimator.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowsePushAnimator.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureBrowsePushAnimator.h"
10 | #import "LYPictureBrowseTransitionParameter.h"
11 |
12 | @implementation LYPictureBrowsePushAnimator
13 |
14 | - (NSTimeInterval)transitionDuration:(id)transitionContext{
15 | return 0.4;
16 | }
17 |
18 | - (void)animateTransition:(id)transitionContext{
19 |
20 | //转场过渡的容器view
21 | UIView *containerView = [transitionContext containerView];
22 |
23 | //ToVC
24 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
25 | UIView *toView = toViewController.view;
26 | toView.hidden = YES;
27 | [containerView addSubview:toView];
28 |
29 | //有渐变的黑色背景
30 | UIView *bgView = [[UIView alloc] initWithFrame:containerView.bounds];
31 | bgView.backgroundColor = [UIColor blackColor];
32 | bgView.alpha = 0;
33 | [containerView addSubview:bgView];
34 |
35 | CGRect fromFrame = [self.transitionParameter.firstVCImgFrames[self.transitionParameter.transitionImgIndex] CGRectValue];
36 | CGRect toFrame = self.transitionParameter.secondVCImgFrame;
37 |
38 | //过渡的图片
39 | UIImageView *transitionImgView = [[UIImageView alloc] initWithImage:self.transitionParameter.transitionImage];
40 | transitionImgView.layer.masksToBounds = YES;
41 | transitionImgView.contentMode = UIViewContentModeScaleAspectFill;
42 | transitionImgView.frame = fromFrame;
43 | [containerView addSubview:transitionImgView];
44 |
45 | //这就是动画啦啦啦
46 | [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
47 |
48 | transitionImgView.frame = toFrame;
49 | bgView.alpha = 1;
50 |
51 | } completion:^(BOOL finished) {
52 |
53 | toView.hidden = NO;
54 |
55 | [bgView removeFromSuperview];
56 | [transitionImgView removeFromSuperview];
57 |
58 | //设置transitionContext通知系统动画执行完毕
59 | [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
60 | }];
61 |
62 | }
63 |
64 | @end
65 |
66 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowseTransitionParameter.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseTransitionParameter.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
11 | #define SCREENHEIGHT ([UIScreen mainScreen].bounds.size.height)
12 |
13 | @interface LYPictureBrowseTransitionParameter : NSObject
14 |
15 | /*
16 | firstVC : 发起查看图片浏览器的界面
17 | secondVC: 图片浏览器界面
18 | */
19 |
20 | //************************** firstVC、secondVC 都需要传值
21 | ///转场过渡image
22 | @property (nonatomic, strong) UIImage *transitionImage;
23 |
24 | ///所浏览图片的下标
25 | @property (nonatomic, assign) NSInteger transitionImgIndex;
26 |
27 |
28 | //************************** 只需要firstVC 传值
29 | ///firstVC 图片的frame数组,记录所有图片view在第一个界面上相对于window的frame
30 | @property (nonatomic, strong) NSArray *firstVCImgFrames;
31 |
32 |
33 | //************************** 只需要secondVC 传值
34 | ///滑动返回手势
35 | @property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
36 | ///当前滑动时,对应图片的frame
37 | @property (nonatomic, assign) CGRect currentPanGestImgFrame;
38 |
39 |
40 | //************************** 只读
41 | ///通过transitionImgIndex在内部计算出来在firstVC上所对应的图片frame
42 | @property (nonatomic, assign, readonly) CGRect firstVCImgFrame;
43 |
44 | ///通过transitionImage在内部计算出来在secondVC上所显示的图片frame
45 | @property (nonatomic, assign, readonly) CGRect secondVCImgFrame;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/Transition/LYPictureBrowseTransitionParameter.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowseTransitionParameter.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureBrowseTransitionParameter.h"
10 |
11 | @implementation LYPictureBrowseTransitionParameter
12 |
13 | - (void)setTransitionImage:(UIImage *)transitionImage{
14 | _transitionImage = transitionImage;
15 |
16 | _secondVCImgFrame = [self backScreenImageViewRectWithImage:transitionImage];
17 | }
18 | - (void)setTransitionImgIndex:(NSInteger)transitionImgIndex{
19 | _transitionImgIndex = transitionImgIndex;
20 |
21 | _firstVCImgFrame = [_firstVCImgFrames[transitionImgIndex] CGRectValue];
22 | }
23 |
24 | //返回imageView在window上全屏显示时的frame
25 | - (CGRect)backScreenImageViewRectWithImage:(UIImage *)image{
26 |
27 | CGSize size = image.size;
28 | CGSize newSize;
29 | newSize.width = SCREENWIDTH;
30 | newSize.height = newSize.width / size.width * size.height;
31 |
32 | CGFloat imageY = (SCREENHEIGHT - newSize.height) * 0.5;
33 |
34 | if (imageY < 0) {
35 | imageY = 0;
36 | }
37 | CGRect rect = CGRectMake(0, imageY, newSize.width, newSize.height);
38 |
39 | return rect;
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/View/LYBrowseZoomScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYBrowseZoomScrollView.h
3 | // LYTransitionDemo
4 | //
5 | // Created by liyang on 16/10/12.
6 | // Copyright © 2016年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 | #define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
11 | #define SCREENHEIGHT ([UIScreen mainScreen].bounds.size.height)
12 |
13 | @interface LYBrowseZoomScrollView : UIScrollView
14 |
15 | @property (nonatomic,strong) UIImageView *zoomImageView;
16 | @property (nonatomic,copy) void (^tapBlock)();
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureBrowse/View/LYPictureBrowserCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureBrowserCell.h
3 | // FollowMe
4 | //
5 | // Created by liyang on 16/10/12.
6 | // Copyright © 2016年 FM. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "LYBrowseZoomScrollView.h"
11 | #import "LYPictureBrowseSouceModel.h"
12 | #define SCREENWIDTH ([UIScreen mainScreen].bounds.size.width)
13 | #define SCREENHEIGHT ([UIScreen mainScreen].bounds.size.height)
14 |
15 | @protocol LYPictureBrowserCellDelegate
16 |
17 | - (void)imageViewClick:(NSInteger)cellIndex;
18 |
19 | @end
20 |
21 | @interface LYPictureBrowserCell : UICollectionViewCell
22 |
23 | @property (nonatomic, weak) id delegate;
24 | @property (nonatomic, assign) NSInteger cellIndex;
25 | @property (nonatomic, strong) LYBrowseZoomScrollView *pictureImageScrollView;
26 |
27 | - (void)showWithModel:(LYPictureBrowseSouceModel *)model;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureFirstPageCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureFirstPageCell.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYPictureFirstPageCell : UICollectionViewCell
12 |
13 | @property (nonatomic, strong) UIImageView *imageView;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureFirstPageCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureFirstPageCell.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "LYPictureFirstPageCell.h"
10 |
11 | @implementation LYPictureFirstPageCell
12 |
13 | - (instancetype)initWithFrame:(CGRect)frame {
14 | self = [super initWithFrame:frame];
15 | if (self) {
16 | self.backgroundColor = [UIColor blackColor];
17 | [self setupView];
18 | }
19 | return self;
20 | }
21 | - (void)setupView {
22 | [self.contentView addSubview:self.imageView];
23 | }
24 |
25 | #pragma mark - Setter and getter
26 |
27 | - (UIImageView *)imageView {
28 | if (!_imageView) {
29 | _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
30 | _imageView.layer.masksToBounds = YES;
31 | _imageView.contentMode = UIViewContentModeScaleAspectFill;
32 | }
33 | return _imageView;
34 | }
35 | @end
36 |
37 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PictureBrowse/LYPictureFirstVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // LYPictureFirstVC.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/12/5.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYPictureFirstVC : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | // 屏幕宽与高
16 | #define kScreenWidth ([UIScreen mainScreen].bounds.size.width)
17 | #define kScreenHeight ([UIScreen mainScreen].bounds.size.height)
18 |
19 | #define kStatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
20 | #define kNavBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height + 44)
21 |
22 | //// 颜色
23 | #define color(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
24 |
25 | ////默认的统一背景色
26 | #define bgColor [UIColor colorWithRed:(240)/255.0 green:(240)/255.0 blue:(240)/255.0 alpha:1.0]
27 |
28 |
29 | #endif /* PrefixHeader_pch */
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Base.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/CATransition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/CATransition.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/.DS_Store
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression01.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression01.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression02.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression02.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression03.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression03.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression04.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression04.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression05.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression05.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression06.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression06.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression07.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression07.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression08.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression08.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression09.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression09.gif
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression10.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression10.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression11.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression11.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression12.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression12.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression13.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression13.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression14.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression14.gif
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Expression/Expression15.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Expression/Expression15.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/Wechat-Interactive.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/Wechat-Interactive.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/back@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/back@2x.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/content.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/content.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/flip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/flip.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/kugoou.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/kugoou.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/kugou-Interactive.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/kugou-Interactive.jpeg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/nodata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/nodata.png
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/wechat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/wechat.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar01.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar02.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar03.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar04.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-liyang/LYCustomTransition/4c451d48fed391e99df29d03b1de66051c7089fd/LYCustomTransitionDemo/Resource/美女与豪车/BeautyCar05.jpg
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/UIViewController+hook.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+hook.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2020/6/23.
6 | // Copyright © 2020 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | NS_ASSUME_NONNULL_BEGIN
12 |
13 | @interface UIViewController (hook)
14 |
15 | @end
16 |
17 | NS_ASSUME_NONNULL_END
18 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/UIViewController+hook.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+hook.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2020/6/23.
6 | // Copyright © 2020 liyang. All rights reserved.
7 | //
8 |
9 | #import "UIViewController+hook.h"
10 | #import
11 |
12 | @implementation UIViewController (hook)
13 |
14 | + (void)load{
15 | SEL originalSel = @selector(presentViewController:animated:completion:);
16 | SEL overrideSel = @selector(override_presentViewController:animated:completion:);
17 | Method originalMet = class_getInstanceMethod(self.class, originalSel);
18 | Method overrideMet = class_getInstanceMethod(self.class, overrideSel);
19 | method_exchangeImplementations(originalMet, overrideMet);
20 | }
21 |
22 | #pragma mark - Swizzling
23 | - (void)override_presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion{
24 | if(@available(iOS 13.0, *)){
25 | if (viewControllerToPresent.modalPresentationStyle == UIModalPresentationPageSheet){
26 | viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen;
27 | }
28 | }
29 | [self override_presentViewController:viewControllerToPresent animated:flag completion:completion];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/22.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | // Do any additional setup after loading the view, typically from a nib.
20 | }
21 |
22 |
23 | - (void)didReceiveMemoryWarning {
24 | [super didReceiveMemoryWarning];
25 | // Dispose of any resources that can be recreated.
26 | }
27 |
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // LYCustomTransitionDemo
4 | //
5 | // Created by liyang on 2017/2/24.
6 | // Copyright © 2017年 liyang. 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 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemoTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemoTests/LYCustomTransitionDemoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYCustomTransitionDemoTests.m
3 | // LYCustomTransitionDemoTests
4 | //
5 | // Created by liyang on 2017/2/24.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYCustomTransitionDemoTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LYCustomTransitionDemoTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemoUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/LYCustomTransitionDemoUITests/LYCustomTransitionDemoUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // LYCustomTransitionDemoUITests.m
3 | // LYCustomTransitionDemoUITests
4 | //
5 | // Created by liyang on 2017/2/24.
6 | // Copyright © 2017年 liyang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface LYCustomTransitionDemoUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation LYCustomTransitionDemoUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 | source 'https://github.com/CocoaPods/Specs.git'
3 | platform :ios, '9.0'
4 | xcodeproj 'LYCustomTransitionDemo.xcodeproj'
5 |
6 | target 'LYCustomTransitionDemo' do
7 |
8 | pod 'SDWebImage', '~> 3.7.0'
9 |
10 | end
11 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (3.7.6):
3 | - SDWebImage/Core (= 3.7.6)
4 | - SDWebImage/Core (3.7.6)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage (~> 3.7.0)
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
11 |
12 | PODFILE CHECKSUM: 0cc2c6a4d45fd2fd40277087381438750811f97f
13 |
14 | COCOAPODS: 1.2.1
15 |
--------------------------------------------------------------------------------
/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SDWebImage (3.7.6):
3 | - SDWebImage/Core (= 3.7.6)
4 | - SDWebImage/Core (3.7.6)
5 |
6 | DEPENDENCIES:
7 | - SDWebImage (~> 3.7.0)
8 |
9 | SPEC CHECKSUMS:
10 | SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
11 |
12 | PODFILE CHECKSUM: 0cc2c6a4d45fd2fd40277087381438750811f97f
13 |
14 | COCOAPODS: 1.2.1
15 |
--------------------------------------------------------------------------------
/Pods/Pods.xcodeproj/xcuserdata/liyang.xcuserdatad/xcschemes/SDWebImage.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Pods/Pods.xcodeproj/xcuserdata/liyang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Pods-LYCustomTransitionDemo.xcscheme
8 |
9 | isShown
10 |
11 |
12 | SDWebImage.xcscheme
13 |
14 | isShown
15 |
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Fabrice Aneche on 06/01/14.
3 | // Copyright (c) 2014 Dailymotion. All rights reserved.
4 | //
5 |
6 | #import
7 |
8 | @interface NSData (ImageContentType)
9 |
10 | /**
11 | * Compute the content type for an image data
12 | *
13 | * @param data the input data
14 | *
15 | * @return the content type as string (i.e. image/jpeg, image/gif)
16 | */
17 | + (NSString *)sd_contentTypeForImageData:(NSData *)data;
18 |
19 | @end
20 |
21 |
22 | @interface NSData (ImageContentTypeDeprecated)
23 |
24 | + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`");
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Fabrice Aneche on 06/01/14.
3 | // Copyright (c) 2014 Dailymotion. All rights reserved.
4 | //
5 |
6 | #import "NSData+ImageContentType.h"
7 |
8 |
9 | @implementation NSData (ImageContentType)
10 |
11 | + (NSString *)sd_contentTypeForImageData:(NSData *)data {
12 | uint8_t c;
13 | [data getBytes:&c length:1];
14 | switch (c) {
15 | case 0xFF:
16 | return @"image/jpeg";
17 | case 0x89:
18 | return @"image/png";
19 | case 0x47:
20 | return @"image/gif";
21 | case 0x49:
22 | case 0x4D:
23 | return @"image/tiff";
24 | case 0x52:
25 | // R as RIFF for WEBP
26 | if ([data length] < 12) {
27 | return nil;
28 | }
29 |
30 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding];
31 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) {
32 | return @"image/webp";
33 | }
34 |
35 | return nil;
36 | }
37 | return nil;
38 | }
39 |
40 | @end
41 |
42 |
43 | @implementation NSData (ImageContentTypeDeprecated)
44 |
45 | + (NSString *)contentTypeForImageData:(NSData *)data {
46 | return [self sd_contentTypeForImageData:data];
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/SDWebImageCompat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | * (c) Jamie Pinkham
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | #import
11 |
12 | #ifdef __OBJC_GC__
13 | #error SDWebImage does not support Objective-C Garbage Collection
14 | #endif
15 |
16 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
17 | #error SDWebImage doesn't support Deployment Target version < 5.0
18 | #endif
19 |
20 | #if !TARGET_OS_IPHONE
21 | #import
22 | #ifndef UIImage
23 | #define UIImage NSImage
24 | #endif
25 | #ifndef UIImageView
26 | #define UIImageView NSImageView
27 | #endif
28 | #else
29 |
30 | #import
31 |
32 | #endif
33 |
34 | #ifndef NS_ENUM
35 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
36 | #endif
37 |
38 | #ifndef NS_OPTIONS
39 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
40 | #endif
41 |
42 | #if OS_OBJECT_USE_OBJC
43 | #undef SDDispatchQueueRelease
44 | #undef SDDispatchQueueSetterSementics
45 | #define SDDispatchQueueRelease(q)
46 | #define SDDispatchQueueSetterSementics strong
47 | #else
48 | #undef SDDispatchQueueRelease
49 | #undef SDDispatchQueueSetterSementics
50 | #define SDDispatchQueueRelease(q) (dispatch_release(q))
51 | #define SDDispatchQueueSetterSementics assign
52 | #endif
53 |
54 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
55 |
56 | typedef void(^SDWebImageNoParamsBlock)();
57 |
58 | extern NSString *const SDWebImageErrorDomain;
59 |
60 | #define dispatch_main_sync_safe(block)\
61 | if ([NSThread isMainThread]) {\
62 | block();\
63 | } else {\
64 | dispatch_sync(dispatch_get_main_queue(), block);\
65 | }
66 |
67 | #define dispatch_main_async_safe(block)\
68 | if ([NSThread isMainThread]) {\
69 | block();\
70 | } else {\
71 | dispatch_async(dispatch_get_main_queue(), block);\
72 | }
73 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/SDWebImageCompat.m:
--------------------------------------------------------------------------------
1 | //
2 | // SDWebImageCompat.m
3 | // SDWebImage
4 | //
5 | // Created by Olivier Poitrey on 11/12/12.
6 | // Copyright (c) 2012 Dailymotion. All rights reserved.
7 | //
8 |
9 | #import "SDWebImageCompat.h"
10 |
11 | #if !__has_feature(objc_arc)
12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
13 | #endif
14 |
15 | inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
16 | if (!image) {
17 | return nil;
18 | }
19 |
20 | if ([image.images count] > 0) {
21 | NSMutableArray *scaledImages = [NSMutableArray array];
22 |
23 | for (UIImage *tempImage in image.images) {
24 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)];
25 | }
26 |
27 | return [UIImage animatedImageWithImages:scaledImages duration:image.duration];
28 | }
29 | else {
30 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
31 | CGFloat scale = 1;
32 | if (key.length >= 8) {
33 | NSRange range = [key rangeOfString:@"@2x."];
34 | if (range.location != NSNotFound) {
35 | scale = 2.0;
36 | }
37 |
38 | range = [key rangeOfString:@"@3x."];
39 | if (range.location != NSNotFound) {
40 | scale = 3.0;
41 | }
42 | }
43 |
44 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];
45 | image = scaledImage;
46 | }
47 | return image;
48 | }
49 | }
50 |
51 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain";
52 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * Created by james on 9/28/11.
6 | *
7 | * For the full copyright and license information, please view the LICENSE
8 | * file that was distributed with this source code.
9 | */
10 |
11 | #import
12 | #import "SDWebImageCompat.h"
13 |
14 | @interface UIImage (ForceDecode)
15 |
16 | + (UIImage *)decodedImageWithImage:(UIImage *)image;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 |
11 | @protocol SDWebImageOperation
12 |
13 | - (void)cancel;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/UIImage+GIF.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+GIF.h
3 | // LBGIFImage
4 | //
5 | // Created by Laurin Brandner on 06.01.12.
6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (GIF)
12 |
13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name;
14 |
15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data;
16 |
17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+MultiFormat.h
3 | // SDWebImage
4 | //
5 | // Created by Olivier Poitrey on 07/06/13.
6 | // Copyright (c) 2013 Dailymotion. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (MultiFormat)
12 |
13 | + (UIImage *)sd_imageWithData:(NSData *)data;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import
10 | #import "SDWebImageManager.h"
11 |
12 | @interface UIView (WebCacheOperation)
13 |
14 | /**
15 | * Set the image load operation (storage in a UIView based dictionary)
16 | *
17 | * @param operation the operation
18 | * @param key key for storing the operation
19 | */
20 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key;
21 |
22 | /**
23 | * Cancel all operations for the current UIView and key
24 | *
25 | * @param key key for identifying the operations
26 | */
27 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key;
28 |
29 | /**
30 | * Just remove the operations corresponding to the current UIView and key without cancelling them
31 | *
32 | * @param key key for identifying the operations
33 | */
34 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the SDWebImage package.
3 | * (c) Olivier Poitrey
4 | *
5 | * For the full copyright and license information, please view the LICENSE
6 | * file that was distributed with this source code.
7 | */
8 |
9 | #import "UIView+WebCacheOperation.h"
10 | #import "objc/runtime.h"
11 |
12 | static char loadOperationKey;
13 |
14 | @implementation UIView (WebCacheOperation)
15 |
16 | - (NSMutableDictionary *)operationDictionary {
17 | NSMutableDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey);
18 | if (operations) {
19 | return operations;
20 | }
21 | operations = [NSMutableDictionary dictionary];
22 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
23 | return operations;
24 | }
25 |
26 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key {
27 | [self sd_cancelImageLoadOperationWithKey:key];
28 | NSMutableDictionary *operationDictionary = [self operationDictionary];
29 | [operationDictionary setObject:operation forKey:key];
30 | }
31 |
32 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key {
33 | // Cancel in progress downloader from queue
34 | NSMutableDictionary *operationDictionary = [self operationDictionary];
35 | id operations = [operationDictionary objectForKey:key];
36 | if (operations) {
37 | if ([operations isKindOfClass:[NSArray class]]) {
38 | for (id operation in operations) {
39 | if (operation) {
40 | [operation cancel];
41 | }
42 | }
43 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){
44 | [(id) operations cancel];
45 | }
46 | [operationDictionary removeObjectForKey:key];
47 | }
48 | }
49 |
50 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key {
51 | NSMutableDictionary *operationDictionary = [self operationDictionary];
52 | [operationDictionary removeObjectForKey:key];
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## SDWebImage
5 |
6 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is furnished
13 | to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in all
16 | copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 |
27 | Generated by CocoaPods - https://cocoapods.org
28 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com
18 |
19 | Permission is hereby granted, free of charge, to any person obtaining a copy
20 | of this software and associated documentation files (the "Software"), to deal
21 | in the Software without restriction, including without limitation the rights
22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 | copies of the Software, and to permit persons to whom the Software is furnished
24 | to do so, subject to the following conditions:
25 |
26 | The above copyright notice and this permission notice shall be included in all
27 | copies or substantial portions of the Software.
28 |
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35 | THE SOFTWARE.
36 |
37 |
38 | License
39 | MIT
40 | Title
41 | SDWebImage
42 | Type
43 | PSGroupSpecifier
44 |
45 |
46 | FooterText
47 | Generated by CocoaPods - https://cocoapods.org
48 | Title
49 |
50 | Type
51 | PSGroupSpecifier
52 |
53 |
54 | StringsTable
55 | Acknowledgements
56 | Title
57 | Acknowledgements
58 |
59 |
60 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_LYCustomTransitionDemo : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_LYCustomTransitionDemo
5 | @end
6 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_LYCustomTransitionDemoVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_LYCustomTransitionDemoVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_LYCustomTransitionDemo {
2 | umbrella header "Pods-LYCustomTransitionDemo-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-LYCustomTransitionDemo/Pods-LYCustomTransitionDemo.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SDWebImage"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | ${PRODUCT_BUNDLE_IDENTIFIER}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 3.7.6
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SDWebImage : NSObject
3 | @end
4 | @implementation PodsDummy_SDWebImage
5 | @end
6 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 | #import "NSData+ImageContentType.h"
14 | #import "SDImageCache.h"
15 | #import "SDWebImageCompat.h"
16 | #import "SDWebImageDecoder.h"
17 | #import "SDWebImageDownloader.h"
18 | #import "SDWebImageDownloaderOperation.h"
19 | #import "SDWebImageManager.h"
20 | #import "SDWebImageOperation.h"
21 | #import "SDWebImagePrefetcher.h"
22 | #import "UIButton+WebCache.h"
23 | #import "UIImage+GIF.h"
24 | #import "UIImage+MultiFormat.h"
25 | #import "UIImageView+HighlightedWebCache.h"
26 | #import "UIImageView+WebCache.h"
27 | #import "UIView+WebCacheOperation.h"
28 |
29 | FOUNDATION_EXPORT double SDWebImageVersionNumber;
30 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];
31 |
32 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap:
--------------------------------------------------------------------------------
1 | framework module SDWebImage {
2 | umbrella header "SDWebImage-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | OTHER_LDFLAGS = -framework "ImageIO"
5 | PODS_BUILD_DIR = $BUILD_DIR
6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
7 | PODS_ROOT = ${SRCROOT}
8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage
9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
10 | SKIP_INSTALL = YES
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LYCustomTransition
2 | iOS自定义交互式转场动画-仿微信图片浏览器转场动画、仿ios系统相册图片浏览转场动画、仿酷狗转场动画 + 交互式图片浏览器
3 |
4 | `简书地址`:http://www.jianshu.com/p/ec08f43808aa
5 | 此文章有详细的讲解说明,望可以帮助到想了解转场的同学
6 |
7 | #### 简书文章讲解目录
8 |
9 | ```
10 | 0、CATransition(系统转场动画)
11 | 一、基础转场-非交互式(初步认识自定义转场动画)
12 | 二、仿酷狗转场-非交互式(巩固对转场的认识)
13 | 三、仿微信转场-非交互式(加强对转场的认识)
14 | 四、基础转场-交互式
15 | 五、实战 - 网友提问 - Question One
16 | 六、图片浏览器-PictureBrowse
17 | ```
18 |
19 |
20 | demo首页菜单.png
21 |
22 | 
23 |
24 | demo整体效果展示动画.gif
25 |
26 | 
27 |
28 | demo图片浏览器动画.gif
29 |
30 | 
31 |
32 | `如果看了本demo及文章能对你有所帮助的小伙伴们,那就来颗星吧!O(∩_∩)O哈哈~`
33 |
--------------------------------------------------------------------------------