├── README.md
├── TestTransition.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── TestTransition.xccheckout
│ └── xcuserdata
│ │ ├── apple.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── zhangao.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ ├── apple.xcuserdatad
│ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ │ ├── TestTransition.xcscheme
│ │ └── xcschememanagement.plist
│ └── zhangao.xcuserdatad
│ └── xcschemes
│ ├── TestTransition.xcscheme
│ └── xcschememanagement.plist
├── TestTransition
├── AppDelegate.swift
├── DetailViewController.swift
├── Images.xcassets
│ ├── 01_animation.imageset
│ │ ├── 01_animation@2x.png
│ │ └── Contents.json
│ ├── 02_animation.imageset
│ │ ├── 02_animation@2x.png
│ │ └── Contents.json
│ ├── 03_animation.imageset
│ │ ├── 03_animation@2x.png
│ │ └── Contents.json
│ ├── 04_animation.imageset
│ │ ├── 04_animation@2x.png
│ │ └── Contents.json
│ ├── 05_animation.imageset
│ │ ├── 05_animation@2x.png
│ │ └── Contents.json
│ ├── 06_animation.imageset
│ │ ├── 06_animation@2x.png
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── Info.plist
├── Main.storyboard
├── ModalViewController.swift
└── ViewController.swift
└── preview.gif
/README.md:
--------------------------------------------------------------------------------
1 | ## 自定义切换动画与交互动画
2 | ### Updated for Xcode 7 With Swift 2.0
3 | 
4 | ----
5 | iOS 自定义页面的切换动画与交互动画 By Swift
6 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 18925B471994D35D000BEEA0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18925B461994D35D000BEEA0 /* AppDelegate.swift */; };
11 | 18925B491994D35D000BEEA0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18925B481994D35D000BEEA0 /* ViewController.swift */; };
12 | 18925B4E1994D35D000BEEA0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18925B4D1994D35D000BEEA0 /* Images.xcassets */; };
13 | 18925B681994D410000BEEA0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18925B671994D410000BEEA0 /* Main.storyboard */; };
14 | 18925B6A1994D495000BEEA0 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18925B691994D495000BEEA0 /* DetailViewController.swift */; };
15 | 18925B9E199711FE000BEEA0 /* ModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18925B9D199711FE000BEEA0 /* ModalViewController.swift */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXContainerItemProxy section */
19 | 18925B541994D35D000BEEA0 /* PBXContainerItemProxy */ = {
20 | isa = PBXContainerItemProxy;
21 | containerPortal = 18925B371994D30C000BEEA0 /* Project object */;
22 | proxyType = 1;
23 | remoteGlobalIDString = 18925B401994D35D000BEEA0;
24 | remoteInfo = TestTransition;
25 | };
26 | 18925B611994D35E000BEEA0 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = 18925B371994D30C000BEEA0 /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = 18925B401994D35D000BEEA0;
31 | remoteInfo = TestTransition;
32 | };
33 | 18925B631994D35E000BEEA0 /* PBXContainerItemProxy */ = {
34 | isa = PBXContainerItemProxy;
35 | containerPortal = 18925B371994D30C000BEEA0 /* Project object */;
36 | proxyType = 1;
37 | remoteGlobalIDString = 18925B401994D35D000BEEA0;
38 | remoteInfo = TestTransition;
39 | };
40 | 18925B651994D389000BEEA0 /* PBXContainerItemProxy */ = {
41 | isa = PBXContainerItemProxy;
42 | containerPortal = 18925B371994D30C000BEEA0 /* Project object */;
43 | proxyType = 1;
44 | remoteGlobalIDString = 18925B401994D35D000BEEA0;
45 | remoteInfo = TestTransition;
46 | };
47 | /* End PBXContainerItemProxy section */
48 |
49 | /* Begin PBXFileReference section */
50 | 18925B411994D35D000BEEA0 /* TestTransition.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestTransition.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 18925B451994D35D000BEEA0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
52 | 18925B461994D35D000BEEA0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
53 | 18925B481994D35D000BEEA0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
54 | 18925B4D1994D35D000BEEA0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
55 | 18925B531994D35D000BEEA0 /* TestTransitionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestTransitionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
56 | 18925B671994D410000BEEA0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; };
57 | 18925B691994D495000BEEA0 /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; };
58 | 18925B9D199711FE000BEEA0 /* ModalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalViewController.swift; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 18925B3E1994D35D000BEEA0 /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | 18925B501994D35D000BEEA0 /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | );
74 | runOnlyForDeploymentPostprocessing = 0;
75 | };
76 | /* End PBXFrameworksBuildPhase section */
77 |
78 | /* Begin PBXGroup section */
79 | 18925B361994D30C000BEEA0 = {
80 | isa = PBXGroup;
81 | children = (
82 | 18925B431994D35D000BEEA0 /* TestTransition */,
83 | 18925B421994D35D000BEEA0 /* Products */,
84 | );
85 | sourceTree = "";
86 | };
87 | 18925B421994D35D000BEEA0 /* Products */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 18925B411994D35D000BEEA0 /* TestTransition.app */,
91 | 18925B531994D35D000BEEA0 /* TestTransitionTests.xctest */,
92 | );
93 | name = Products;
94 | sourceTree = "";
95 | };
96 | 18925B431994D35D000BEEA0 /* TestTransition */ = {
97 | isa = PBXGroup;
98 | children = (
99 | 18925B461994D35D000BEEA0 /* AppDelegate.swift */,
100 | 18925B481994D35D000BEEA0 /* ViewController.swift */,
101 | 18925B691994D495000BEEA0 /* DetailViewController.swift */,
102 | 18925B9D199711FE000BEEA0 /* ModalViewController.swift */,
103 | 18925B4D1994D35D000BEEA0 /* Images.xcassets */,
104 | 18925B671994D410000BEEA0 /* Main.storyboard */,
105 | 18925B441994D35D000BEEA0 /* Supporting Files */,
106 | );
107 | path = TestTransition;
108 | sourceTree = "";
109 | };
110 | 18925B441994D35D000BEEA0 /* Supporting Files */ = {
111 | isa = PBXGroup;
112 | children = (
113 | 18925B451994D35D000BEEA0 /* Info.plist */,
114 | );
115 | name = "Supporting Files";
116 | sourceTree = "";
117 | };
118 | /* End PBXGroup section */
119 |
120 | /* Begin PBXNativeTarget section */
121 | 18925B401994D35D000BEEA0 /* TestTransition */ = {
122 | isa = PBXNativeTarget;
123 | buildConfigurationList = 18925B5B1994D35D000BEEA0 /* Build configuration list for PBXNativeTarget "TestTransition" */;
124 | buildPhases = (
125 | 18925B3D1994D35D000BEEA0 /* Sources */,
126 | 18925B3E1994D35D000BEEA0 /* Frameworks */,
127 | 18925B3F1994D35D000BEEA0 /* Resources */,
128 | );
129 | buildRules = (
130 | );
131 | dependencies = (
132 | );
133 | name = TestTransition;
134 | productName = TestTransition;
135 | productReference = 18925B411994D35D000BEEA0 /* TestTransition.app */;
136 | productType = "com.apple.product-type.application";
137 | };
138 | 18925B521994D35D000BEEA0 /* TestTransitionTests */ = {
139 | isa = PBXNativeTarget;
140 | buildConfigurationList = 18925B5E1994D35D000BEEA0 /* Build configuration list for PBXNativeTarget "TestTransitionTests" */;
141 | buildPhases = (
142 | 18925B4F1994D35D000BEEA0 /* Sources */,
143 | 18925B501994D35D000BEEA0 /* Frameworks */,
144 | 18925B511994D35D000BEEA0 /* Resources */,
145 | );
146 | buildRules = (
147 | );
148 | dependencies = (
149 | 18925B551994D35D000BEEA0 /* PBXTargetDependency */,
150 | 18925B621994D35E000BEEA0 /* PBXTargetDependency */,
151 | 18925B641994D35E000BEEA0 /* PBXTargetDependency */,
152 | 18925B661994D389000BEEA0 /* PBXTargetDependency */,
153 | );
154 | name = TestTransitionTests;
155 | productName = TestTransitionTests;
156 | productReference = 18925B531994D35D000BEEA0 /* TestTransitionTests.xctest */;
157 | productType = "com.apple.product-type.bundle.unit-test";
158 | };
159 | /* End PBXNativeTarget section */
160 |
161 | /* Begin PBXProject section */
162 | 18925B371994D30C000BEEA0 /* Project object */ = {
163 | isa = PBXProject;
164 | attributes = {
165 | LastSwiftUpdateCheck = 0710;
166 | LastUpgradeCheck = 0710;
167 | TargetAttributes = {
168 | 18925B401994D35D000BEEA0 = {
169 | CreatedOnToolsVersion = 6.0;
170 | };
171 | 18925B521994D35D000BEEA0 = {
172 | CreatedOnToolsVersion = 6.0;
173 | TestTargetID = 18925B401994D35D000BEEA0;
174 | };
175 | };
176 | };
177 | buildConfigurationList = 18925B3A1994D30C000BEEA0 /* Build configuration list for PBXProject "TestTransition" */;
178 | compatibilityVersion = "Xcode 3.2";
179 | developmentRegion = English;
180 | hasScannedForEncodings = 0;
181 | knownRegions = (
182 | en,
183 | Base,
184 | );
185 | mainGroup = 18925B361994D30C000BEEA0;
186 | productRefGroup = 18925B421994D35D000BEEA0 /* Products */;
187 | projectDirPath = "";
188 | projectRoot = "";
189 | targets = (
190 | 18925B401994D35D000BEEA0 /* TestTransition */,
191 | 18925B521994D35D000BEEA0 /* TestTransitionTests */,
192 | );
193 | };
194 | /* End PBXProject section */
195 |
196 | /* Begin PBXResourcesBuildPhase section */
197 | 18925B3F1994D35D000BEEA0 /* Resources */ = {
198 | isa = PBXResourcesBuildPhase;
199 | buildActionMask = 2147483647;
200 | files = (
201 | 18925B4E1994D35D000BEEA0 /* Images.xcassets in Resources */,
202 | 18925B681994D410000BEEA0 /* Main.storyboard in Resources */,
203 | );
204 | runOnlyForDeploymentPostprocessing = 0;
205 | };
206 | 18925B511994D35D000BEEA0 /* Resources */ = {
207 | isa = PBXResourcesBuildPhase;
208 | buildActionMask = 2147483647;
209 | files = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | };
213 | /* End PBXResourcesBuildPhase section */
214 |
215 | /* Begin PBXSourcesBuildPhase section */
216 | 18925B3D1994D35D000BEEA0 /* Sources */ = {
217 | isa = PBXSourcesBuildPhase;
218 | buildActionMask = 2147483647;
219 | files = (
220 | 18925B9E199711FE000BEEA0 /* ModalViewController.swift in Sources */,
221 | 18925B6A1994D495000BEEA0 /* DetailViewController.swift in Sources */,
222 | 18925B491994D35D000BEEA0 /* ViewController.swift in Sources */,
223 | 18925B471994D35D000BEEA0 /* AppDelegate.swift in Sources */,
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | };
227 | 18925B4F1994D35D000BEEA0 /* Sources */ = {
228 | isa = PBXSourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | );
232 | runOnlyForDeploymentPostprocessing = 0;
233 | };
234 | /* End PBXSourcesBuildPhase section */
235 |
236 | /* Begin PBXTargetDependency section */
237 | 18925B551994D35D000BEEA0 /* PBXTargetDependency */ = {
238 | isa = PBXTargetDependency;
239 | target = 18925B401994D35D000BEEA0 /* TestTransition */;
240 | targetProxy = 18925B541994D35D000BEEA0 /* PBXContainerItemProxy */;
241 | };
242 | 18925B621994D35E000BEEA0 /* PBXTargetDependency */ = {
243 | isa = PBXTargetDependency;
244 | target = 18925B401994D35D000BEEA0 /* TestTransition */;
245 | targetProxy = 18925B611994D35E000BEEA0 /* PBXContainerItemProxy */;
246 | };
247 | 18925B641994D35E000BEEA0 /* PBXTargetDependency */ = {
248 | isa = PBXTargetDependency;
249 | target = 18925B401994D35D000BEEA0 /* TestTransition */;
250 | targetProxy = 18925B631994D35E000BEEA0 /* PBXContainerItemProxy */;
251 | };
252 | 18925B661994D389000BEEA0 /* PBXTargetDependency */ = {
253 | isa = PBXTargetDependency;
254 | target = 18925B401994D35D000BEEA0 /* TestTransition */;
255 | targetProxy = 18925B651994D389000BEEA0 /* PBXContainerItemProxy */;
256 | };
257 | /* End PBXTargetDependency section */
258 |
259 | /* Begin XCBuildConfiguration section */
260 | 18925B3B1994D30C000BEEA0 /* Debug */ = {
261 | isa = XCBuildConfiguration;
262 | buildSettings = {
263 | ENABLE_TESTABILITY = YES;
264 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
265 | ONLY_ACTIVE_ARCH = YES;
266 | SDKROOT = iphoneos;
267 | };
268 | name = Debug;
269 | };
270 | 18925B3C1994D30C000BEEA0 /* Release */ = {
271 | isa = XCBuildConfiguration;
272 | buildSettings = {
273 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
274 | SDKROOT = iphoneos;
275 | };
276 | name = Release;
277 | };
278 | 18925B5C1994D35D000BEEA0 /* Debug */ = {
279 | isa = XCBuildConfiguration;
280 | buildSettings = {
281 | ALWAYS_SEARCH_USER_PATHS = NO;
282 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
283 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
285 | CLANG_CXX_LIBRARY = "libc++";
286 | CLANG_ENABLE_MODULES = YES;
287 | CLANG_ENABLE_OBJC_ARC = YES;
288 | CLANG_WARN_BOOL_CONVERSION = YES;
289 | CLANG_WARN_CONSTANT_CONVERSION = YES;
290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
291 | CLANG_WARN_EMPTY_BODY = YES;
292 | CLANG_WARN_ENUM_CONVERSION = YES;
293 | CLANG_WARN_INT_CONVERSION = YES;
294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
295 | CLANG_WARN_UNREACHABLE_CODE = YES;
296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
297 | CODE_SIGN_IDENTITY = "iPhone Developer";
298 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
299 | COPY_PHASE_STRIP = NO;
300 | ENABLE_STRICT_OBJC_MSGSEND = YES;
301 | GCC_C_LANGUAGE_STANDARD = gnu99;
302 | GCC_DYNAMIC_NO_PIC = NO;
303 | GCC_OPTIMIZATION_LEVEL = 0;
304 | GCC_PREPROCESSOR_DEFINITIONS = (
305 | "DEBUG=1",
306 | "$(inherited)",
307 | );
308 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
309 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
310 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
311 | GCC_WARN_UNDECLARED_SELECTOR = YES;
312 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
313 | GCC_WARN_UNUSED_FUNCTION = YES;
314 | GCC_WARN_UNUSED_VARIABLE = YES;
315 | INFOPLIST_FILE = TestTransition/Info.plist;
316 | IPHONEOS_DEPLOYMENT_TARGET = 7.1;
317 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
318 | MTL_ENABLE_DEBUG_INFO = YES;
319 | ONLY_ACTIVE_ARCH = YES;
320 | PRODUCT_BUNDLE_IDENTIFIER = "zhangao.${PRODUCT_NAME:rfc1034identifier}";
321 | PRODUCT_NAME = "$(TARGET_NAME)";
322 | SDKROOT = iphoneos;
323 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
324 | TARGETED_DEVICE_FAMILY = 1;
325 | };
326 | name = Debug;
327 | };
328 | 18925B5D1994D35D000BEEA0 /* Release */ = {
329 | isa = XCBuildConfiguration;
330 | buildSettings = {
331 | ALWAYS_SEARCH_USER_PATHS = NO;
332 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
333 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
334 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
335 | CLANG_CXX_LIBRARY = "libc++";
336 | CLANG_ENABLE_MODULES = YES;
337 | CLANG_ENABLE_OBJC_ARC = YES;
338 | CLANG_WARN_BOOL_CONVERSION = YES;
339 | CLANG_WARN_CONSTANT_CONVERSION = YES;
340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
341 | CLANG_WARN_EMPTY_BODY = YES;
342 | CLANG_WARN_ENUM_CONVERSION = YES;
343 | CLANG_WARN_INT_CONVERSION = YES;
344 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | CODE_SIGN_IDENTITY = "iPhone Developer";
348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
349 | COPY_PHASE_STRIP = YES;
350 | ENABLE_NS_ASSERTIONS = NO;
351 | ENABLE_STRICT_OBJC_MSGSEND = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu99;
353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
355 | GCC_WARN_UNDECLARED_SELECTOR = YES;
356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
357 | GCC_WARN_UNUSED_FUNCTION = YES;
358 | GCC_WARN_UNUSED_VARIABLE = YES;
359 | INFOPLIST_FILE = TestTransition/Info.plist;
360 | IPHONEOS_DEPLOYMENT_TARGET = 7.1;
361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
362 | MTL_ENABLE_DEBUG_INFO = NO;
363 | PRODUCT_BUNDLE_IDENTIFIER = "zhangao.${PRODUCT_NAME:rfc1034identifier}";
364 | PRODUCT_NAME = "$(TARGET_NAME)";
365 | SDKROOT = iphoneos;
366 | TARGETED_DEVICE_FAMILY = 1;
367 | VALIDATE_PRODUCT = YES;
368 | };
369 | name = Release;
370 | };
371 | 18925B5F1994D35D000BEEA0 /* Debug */ = {
372 | isa = XCBuildConfiguration;
373 | buildSettings = {
374 | ALWAYS_SEARCH_USER_PATHS = NO;
375 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TestTransition.app/TestTransition";
376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
377 | CLANG_CXX_LIBRARY = "libc++";
378 | CLANG_ENABLE_MODULES = YES;
379 | CLANG_ENABLE_OBJC_ARC = YES;
380 | CLANG_WARN_BOOL_CONVERSION = YES;
381 | CLANG_WARN_CONSTANT_CONVERSION = YES;
382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
383 | CLANG_WARN_EMPTY_BODY = YES;
384 | CLANG_WARN_ENUM_CONVERSION = YES;
385 | CLANG_WARN_INT_CONVERSION = YES;
386 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
387 | CLANG_WARN_UNREACHABLE_CODE = YES;
388 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
389 | COPY_PHASE_STRIP = NO;
390 | ENABLE_STRICT_OBJC_MSGSEND = YES;
391 | FRAMEWORK_SEARCH_PATHS = (
392 | "$(SDKROOT)/Developer/Library/Frameworks",
393 | "$(inherited)",
394 | );
395 | GCC_C_LANGUAGE_STANDARD = gnu99;
396 | GCC_DYNAMIC_NO_PIC = NO;
397 | GCC_OPTIMIZATION_LEVEL = 0;
398 | GCC_PREPROCESSOR_DEFINITIONS = (
399 | "DEBUG=1",
400 | "$(inherited)",
401 | );
402 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
403 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
404 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
405 | GCC_WARN_UNDECLARED_SELECTOR = YES;
406 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
407 | GCC_WARN_UNUSED_FUNCTION = YES;
408 | GCC_WARN_UNUSED_VARIABLE = YES;
409 | INFOPLIST_FILE = TestTransitionTests/Info.plist;
410 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
412 | MTL_ENABLE_DEBUG_INFO = YES;
413 | ONLY_ACTIVE_ARCH = YES;
414 | PRODUCT_NAME = "$(TARGET_NAME)";
415 | SDKROOT = iphoneos;
416 | TEST_HOST = "$(BUNDLE_LOADER)";
417 | };
418 | name = Debug;
419 | };
420 | 18925B601994D35D000BEEA0 /* Release */ = {
421 | isa = XCBuildConfiguration;
422 | buildSettings = {
423 | ALWAYS_SEARCH_USER_PATHS = NO;
424 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TestTransition.app/TestTransition";
425 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
426 | CLANG_CXX_LIBRARY = "libc++";
427 | CLANG_ENABLE_MODULES = YES;
428 | CLANG_ENABLE_OBJC_ARC = YES;
429 | CLANG_WARN_BOOL_CONVERSION = YES;
430 | CLANG_WARN_CONSTANT_CONVERSION = YES;
431 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
432 | CLANG_WARN_EMPTY_BODY = YES;
433 | CLANG_WARN_ENUM_CONVERSION = YES;
434 | CLANG_WARN_INT_CONVERSION = YES;
435 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
436 | CLANG_WARN_UNREACHABLE_CODE = YES;
437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
438 | COPY_PHASE_STRIP = YES;
439 | ENABLE_NS_ASSERTIONS = NO;
440 | ENABLE_STRICT_OBJC_MSGSEND = YES;
441 | FRAMEWORK_SEARCH_PATHS = (
442 | "$(SDKROOT)/Developer/Library/Frameworks",
443 | "$(inherited)",
444 | );
445 | GCC_C_LANGUAGE_STANDARD = gnu99;
446 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
447 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
448 | GCC_WARN_UNDECLARED_SELECTOR = YES;
449 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
450 | GCC_WARN_UNUSED_FUNCTION = YES;
451 | GCC_WARN_UNUSED_VARIABLE = YES;
452 | INFOPLIST_FILE = TestTransitionTests/Info.plist;
453 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
455 | MTL_ENABLE_DEBUG_INFO = NO;
456 | PRODUCT_NAME = "$(TARGET_NAME)";
457 | SDKROOT = iphoneos;
458 | TEST_HOST = "$(BUNDLE_LOADER)";
459 | VALIDATE_PRODUCT = YES;
460 | };
461 | name = Release;
462 | };
463 | /* End XCBuildConfiguration section */
464 |
465 | /* Begin XCConfigurationList section */
466 | 18925B3A1994D30C000BEEA0 /* Build configuration list for PBXProject "TestTransition" */ = {
467 | isa = XCConfigurationList;
468 | buildConfigurations = (
469 | 18925B3B1994D30C000BEEA0 /* Debug */,
470 | 18925B3C1994D30C000BEEA0 /* Release */,
471 | );
472 | defaultConfigurationIsVisible = 0;
473 | defaultConfigurationName = Release;
474 | };
475 | 18925B5B1994D35D000BEEA0 /* Build configuration list for PBXNativeTarget "TestTransition" */ = {
476 | isa = XCConfigurationList;
477 | buildConfigurations = (
478 | 18925B5C1994D35D000BEEA0 /* Debug */,
479 | 18925B5D1994D35D000BEEA0 /* Release */,
480 | );
481 | defaultConfigurationIsVisible = 0;
482 | defaultConfigurationName = Release;
483 | };
484 | 18925B5E1994D35D000BEEA0 /* Build configuration list for PBXNativeTarget "TestTransitionTests" */ = {
485 | isa = XCConfigurationList;
486 | buildConfigurations = (
487 | 18925B5F1994D35D000BEEA0 /* Debug */,
488 | 18925B601994D35D000BEEA0 /* Release */,
489 | );
490 | defaultConfigurationIsVisible = 0;
491 | defaultConfigurationName = Release;
492 | };
493 | /* End XCConfigurationList section */
494 | };
495 | rootObject = 18925B371994D30C000BEEA0 /* Project object */;
496 | }
497 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/project.xcworkspace/xcshareddata/TestTransition.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | A1DDD9F1-D86F-4A66-956A-4FEB1FD8DB70
9 | IDESourceControlProjectName
10 | TestTransition
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | B7033C525BC899FC7783D7B8B3536DD4438AEB04
14 | https://github.com/zhangao0086/iOS_AnimatedTransition.git
15 |
16 | IDESourceControlProjectPath
17 | TestTransition.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | B7033C525BC899FC7783D7B8B3536DD4438AEB04
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/zhangao0086/iOS_AnimatedTransition.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | B7033C525BC899FC7783D7B8B3536DD4438AEB04
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | B7033C525BC899FC7783D7B8B3536DD4438AEB04
36 | IDESourceControlWCCName
37 | TestTransition
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/project.xcworkspace/xcuserdata/zhangao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition.xcodeproj/project.xcworkspace/xcuserdata/zhangao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/TestTransition.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | TestTransition.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 18925B401994D35D000BEEA0
16 |
17 | primary
18 |
19 |
20 | 18925B521994D35D000BEEA0
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/xcuserdata/zhangao.xcuserdatad/xcschemes/TestTransition.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/TestTransition.xcodeproj/xcuserdata/zhangao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | TestTransition.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 18925B401994D35D000BEEA0
16 |
17 | primary
18 |
19 |
20 | 18925B521994D35D000BEEA0
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/TestTransition/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // TestTransition
4 | //
5 | // Created by ZhangAo on 14-8-8.
6 | //
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | func applicationWillResignActive(application: UIApplication) {
22 | // 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.
23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
24 | }
25 |
26 | func applicationDidEnterBackground(application: UIApplication) {
27 | // 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.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | func applicationWillEnterForeground(application: UIApplication) {
32 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
33 | }
34 |
35 | func applicationDidBecomeActive(application: UIApplication) {
36 | // 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.
37 | }
38 |
39 | func applicationWillTerminate(application: UIApplication) {
40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
41 | }
42 |
43 |
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/TestTransition/DetailViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DetailViewController.swift
3 | // TestTransition
4 | //
5 | // Created by ZhangAo on 14-8-8.
6 | //
7 | //
8 | enum ModalPresentingType {
9 | case Present, Dismiss
10 | }
11 |
12 | import UIKit
13 |
14 | class DetailViewController: UIViewController ,UIViewControllerTransitioningDelegate ,UIViewControllerAnimatedTransitioning {
15 | var modalPresentingType: ModalPresentingType?
16 | var detailImage: UIImage?
17 |
18 | @IBOutlet weak var detailImageView: UIImageView?
19 |
20 | override func awakeFromNib() {
21 | super.awakeFromNib()
22 | }
23 | override func viewDidLoad() {
24 | super.viewDidLoad()
25 | self.detailImageView?.image = self.detailImage
26 | }
27 |
28 | deinit {
29 | print("DetailVC deinit")
30 | }
31 |
32 | override func didReceiveMemoryWarning() {
33 | super.didReceiveMemoryWarning()
34 | // Dispose of any resources that can be recreated.
35 | }
36 |
37 |
38 | // MARK: - Navigation
39 |
40 | // In a storyboard-based application, you will often want to do a little preparation before navigation
41 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
42 | let modal = segue.destinationViewController
43 | modal.transitioningDelegate = self
44 | }
45 |
46 | //UIViewControllerTransitioningDelegate
47 | func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
48 | modalPresentingType = ModalPresentingType.Present
49 | return self
50 | }
51 |
52 | func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
53 | modalPresentingType = ModalPresentingType.Dismiss
54 | return self
55 | }
56 |
57 | //UIViewControllerAnimatedTransitioning
58 | func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
59 | return 0.6
60 | }
61 |
62 | func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
63 | let containerView = transitionContext.containerView()!
64 |
65 | let toViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!
66 | let fromViewController = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!
67 |
68 | var destView: UIView!
69 | var destTransfrom = CGAffineTransformIdentity
70 | let screenHeight = UIScreen.mainScreen().bounds.size.height
71 |
72 | if modalPresentingType == ModalPresentingType.Present {
73 | destView = toViewController.view
74 | destView.transform = CGAffineTransformMakeTranslation(0, screenHeight)
75 | containerView.addSubview(toViewController.view)
76 | } else if modalPresentingType == ModalPresentingType.Dismiss {
77 | destView = fromViewController.view
78 | destTransfrom = CGAffineTransformMakeTranslation(0, screenHeight)
79 | containerView.insertSubview(toViewController.view, belowSubview: fromViewController.view)
80 | }
81 |
82 | UIView.animateWithDuration(transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0,
83 | options: UIViewAnimationOptions.CurveLinear, animations: {
84 | destView.transform = destTransfrom
85 | }, completion: {completed in
86 | transitionContext.completeTransition(true)
87 | })
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/01_animation.imageset/01_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/01_animation.imageset/01_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/01_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "01_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/02_animation.imageset/02_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/02_animation.imageset/02_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/02_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "02_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/03_animation.imageset/03_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/03_animation.imageset/03_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/03_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "03_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/04_animation.imageset/04_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/04_animation.imageset/04_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/04_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "04_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/05_animation.imageset/05_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/05_animation.imageset/05_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/05_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "05_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/06_animation.imageset/06_animation@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/TestTransition/Images.xcassets/06_animation.imageset/06_animation@2x.png
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/06_animation.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "06_animation@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "ipad",
20 | "size" : "29x29",
21 | "scale" : "1x"
22 | },
23 | {
24 | "idiom" : "ipad",
25 | "size" : "29x29",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "ipad",
30 | "size" : "40x40",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "40x40",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "76x76",
41 | "scale" : "1x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "76x76",
46 | "scale" : "2x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/TestTransition/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | },
18 | {
19 | "orientation" : "portrait",
20 | "idiom" : "ipad",
21 | "extent" : "full-screen",
22 | "minimum-system-version" : "7.0",
23 | "scale" : "1x"
24 | },
25 | {
26 | "orientation" : "landscape",
27 | "idiom" : "ipad",
28 | "extent" : "full-screen",
29 | "minimum-system-version" : "7.0",
30 | "scale" : "1x"
31 | },
32 | {
33 | "orientation" : "portrait",
34 | "idiom" : "ipad",
35 | "extent" : "full-screen",
36 | "minimum-system-version" : "7.0",
37 | "scale" : "2x"
38 | },
39 | {
40 | "orientation" : "landscape",
41 | "idiom" : "ipad",
42 | "extent" : "full-screen",
43 | "minimum-system-version" : "7.0",
44 | "scale" : "2x"
45 | }
46 | ],
47 | "info" : {
48 | "version" : 1,
49 | "author" : "xcode"
50 | }
51 | }
--------------------------------------------------------------------------------
/TestTransition/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | Main
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TestTransition/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
42 |
52 |
62 |
72 |
82 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
150 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
--------------------------------------------------------------------------------
/TestTransition/ModalViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ModalViewController.swift
3 | // TestTransition
4 | //
5 | // Created by ZhangAo on 14-8-10.
6 | //
7 | //
8 |
9 | import UIKit
10 |
11 | class ModalViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 |
16 | // Do any additional setup after loading the view.
17 | }
18 |
19 | override func didReceiveMemoryWarning() {
20 | super.didReceiveMemoryWarning()
21 | // Dispose of any resources that can be recreated.
22 | }
23 |
24 | @IBAction func dismiss() {
25 | dismissViewControllerAnimated(true, completion: nil)
26 | }
27 |
28 |
29 | /*
30 | // MARK: - Navigation
31 |
32 | // In a storyboard-based application, you will often want to do a little preparation before navigation
33 | override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
34 | // Get the new view controller using segue.destinationViewController.
35 | // Pass the selected object to the new view controller.
36 | }
37 | */
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/TestTransition/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // TestTransition
4 | //
5 | // Created by ZhangAo on 14-8-8.
6 | //
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController ,UINavigationControllerDelegate ,UIViewControllerAnimatedTransitioning
12 | /*,UIViewControllerInteractiveTransitioning*/ {
13 | var navigationOperation: UINavigationControllerOperation?
14 | var selectedIndex = 0
15 | var interactivePopTransition: UIPercentDrivenInteractiveTransition!
16 |
17 | override func viewDidLoad() {
18 | super.viewDidLoad()
19 |
20 | self.navigationController?.delegate = self
21 | self.navigationController!.view.backgroundColor = UIColor.whiteColor()
22 |
23 | let popRecognizer = UIScreenEdgePanGestureRecognizer(target: self, action: Selector("handlePopRecognizer:"))
24 | popRecognizer.edges = UIRectEdge.Left
25 | self.navigationController!.view.addGestureRecognizer(popRecognizer)
26 | }
27 |
28 | override func didReceiveMemoryWarning() {
29 | super.didReceiveMemoryWarning()
30 | // Dispose of any resources that can be recreated.
31 | }
32 |
33 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
34 | let detailVC = segue.destinationViewController as! DetailViewController
35 | detailVC.detailImage = sender?.imageForState(UIControlState.Normal)
36 | selectedIndex = sender.tag
37 | }
38 |
39 | func handlePopRecognizer(popRecognizer: UIScreenEdgePanGestureRecognizer) {
40 | var progress = popRecognizer.translationInView(navigationController!.view).x / navigationController!.view.bounds.size.width
41 | progress = min(1.0, max(0.0, progress))
42 |
43 | print("\(progress)")
44 | if popRecognizer.state == UIGestureRecognizerState.Began {
45 | print("Began")
46 | self.interactivePopTransition = UIPercentDrivenInteractiveTransition()
47 | self.navigationController!.popViewControllerAnimated(true)
48 | } else if popRecognizer.state == UIGestureRecognizerState.Changed {
49 | self.interactivePopTransition!.updateInteractiveTransition(progress)
50 | // updateWithPercent(progress)
51 | print("Changed")
52 | } else if popRecognizer.state == UIGestureRecognizerState.Ended || popRecognizer.state == UIGestureRecognizerState.Cancelled {
53 | if progress > 0.5 {
54 | self.interactivePopTransition!.finishInteractiveTransition()
55 | } else {
56 | self.interactivePopTransition!.cancelInteractiveTransition()
57 | }
58 | // finishBy(progress < 0.5)
59 | print("Ended || Cancelled")
60 | self.interactivePopTransition = nil
61 | }
62 | }
63 |
64 | //UIViewControllerInteractiveTransitioning
65 | // func startInteractiveTransition(transitionContext: UIViewControllerContextTransitioning!) {
66 | // self.transitionContext = transitionContext
67 | //
68 | // let containerView = transitionContext.containerView()
69 | // let toViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)
70 | // let fromViewController = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)
71 | //
72 | // containerView.insertSubview(toViewController.view, belowSubview: fromViewController.view)
73 | //
74 | // self.transitingView = fromViewController.view
75 | // self.transitingDestView = toViewController.view
76 | // }
77 | //
78 | // func updateWithPercent(percent: CGFloat) {
79 | // let scale = CGFloat(fabsf(Float(percent - CGFloat(1.0))))
80 | // transitingView?.transform = CGAffineTransformMakeScale(scale, scale)
81 | // transitionContext?.updateInteractiveTransition(percent)
82 | // self.transitingDestView?.alpha = percent
83 | // }
84 | //
85 | // func finishBy(cancelled: Bool) {
86 | // if cancelled {
87 | // UIView.animateWithDuration(0.4, animations: {
88 | // self.transitingView!.transform = CGAffineTransformIdentity
89 | // self.transitingDestView?.alpha = 0
90 | // }, completion: {completed in
91 | // self.transitionContext!.cancelInteractiveTransition()
92 | // self.transitionContext!.completeTransition(false)
93 | // })
94 | // } else {
95 | // UIView.animateWithDuration(0.4, animations: {
96 | // print(self.transitingView)
97 | // self.transitingView!.transform = CGAffineTransformMakeScale(0, 0)
98 | // self.transitingDestView?.alpha = 1
99 | // print(self.transitingView)
100 | // }, completion: {completed in
101 | // self.transitionContext!.finishInteractiveTransition()
102 | // self.transitionContext!.completeTransition(true)
103 | // })
104 | // }
105 | // }
106 |
107 | // UINavigationControllerDelegate
108 | func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
109 | // if operation == UINavigationControllerOperation.Push {
110 | navigationOperation = operation
111 | return self
112 |
113 | // }
114 | // return nil
115 | }
116 |
117 | func navigationController(navigationController: UINavigationController, interactionControllerForAnimationController animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
118 | if self.interactivePopTransition == nil {
119 | return nil
120 | }
121 | return self.interactivePopTransition
122 | }
123 |
124 | //UIViewControllerTransitioningDelegate
125 | func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
126 | return 0.4
127 | }
128 |
129 | func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
130 | let containerView = transitionContext.containerView()!
131 | let toViewController = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)!
132 | let fromViewController = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)!
133 |
134 | var detailVC: DetailViewController!
135 | var fromView: UIView!
136 | var alpha: CGFloat = 1.0
137 | var destTransform: CGAffineTransform!
138 |
139 | var snapshotImageView: UIView!
140 | //获取到当前选择的Button
141 | let originalView = self.view.viewWithTag(selectedIndex)
142 |
143 | if navigationOperation == UINavigationControllerOperation.Push {
144 | containerView.insertSubview(toViewController.view, aboveSubview: fromViewController.view)
145 | snapshotImageView = originalView?.snapshotViewAfterScreenUpdates(false)
146 | detailVC = toViewController as! DetailViewController
147 | fromView = fromViewController.view
148 | alpha = 0
149 | detailVC.view.transform = CGAffineTransformMakeScale(0.1, 0.1)
150 | destTransform = CGAffineTransformMakeScale(1, 1)
151 | snapshotImageView.frame = originalView!.frame
152 | } else if navigationOperation == UINavigationControllerOperation.Pop {
153 | containerView.insertSubview(toViewController.view, belowSubview: fromViewController.view)
154 | detailVC = fromViewController as! DetailViewController
155 | snapshotImageView = detailVC.detailImageView?.snapshotViewAfterScreenUpdates(false)
156 | fromView = toViewController.view
157 | // 如果IDE是Xcode6 Beta4+iOS8SDK,那么在此处设置为0,动画将会不被执行(不确定是哪里的Bug)
158 | destTransform = CGAffineTransformMakeScale(0.1, 0.1)
159 | snapshotImageView.frame = detailVC.detailImageView!.frame
160 | }
161 | originalView?.hidden = true
162 | detailVC.detailImageView?.hidden = true
163 |
164 | containerView.addSubview(snapshotImageView)
165 |
166 | UIView.animateWithDuration(transitionDuration(transitionContext), animations: {
167 | detailVC.view.transform = destTransform
168 | fromView.alpha = alpha
169 | if self.navigationOperation == UINavigationControllerOperation.Push {
170 | snapshotImageView.frame = detailVC.detailImageView!.frame
171 | } else if self.navigationOperation == UINavigationControllerOperation.Pop {
172 | snapshotImageView.frame = originalView!.frame
173 | }
174 | }, completion: ({completed in
175 | originalView?.hidden = false
176 | detailVC.detailImageView?.hidden = false
177 | snapshotImageView.removeFromSuperview()
178 | //告诉系统你的动画过程已经结束,这是非常重要的方法,必须调用。
179 | transitionContext.completeTransition(!transitionContext.transitionWasCancelled())
180 | }))
181 | }
182 |
183 | }
184 |
185 |
--------------------------------------------------------------------------------
/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangao0086/iOS_AnimatedTransition/6f386ff8ae29cc333a51849729d3b77a129fbb41/preview.gif
--------------------------------------------------------------------------------