├── .gitignore ├── README.md └── animation_helper_API └── Animation_Helper_API_Explained ├── Animation_Helper_API_Explained.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── alexjiang.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── alexjiang.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── Animation_Helper_API_Explained.xcscheme │ └── xcschememanagement.plist └── Animation_Helper_API_Explained ├── AppDelegate.swift ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── CustomButton.swift ├── CustomView.swift ├── Info.plist └── ViewController.swift /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.xcuserstate 3 | 4 | animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/project.xcworkspace/xcuserdata/alexjiang.xcuserdatad/UserInterfaceState.xcuserstate 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is the repo contains code for my blog post "Dive into iOS animations" 2 | ======= 3 | 4 | My [post](http://pigfly.github.io/ios/animation/2016/03/01/Dive-Into-iOS-Animation-Series-1/). 5 | 6 | License 7 | ------- 8 | 9 | [![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png)](http://creativecommons.org/licenses/by/4.0/) 10 | 11 | This work by [Alex Jiang](http://pigfly.io) is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). 12 | 13 | Code I've written is [licensed](/LICENSE) under MIT. Other components such as [Bootstrap](http://getbootstrap.com) have their own licenses. 14 | 15 | Thanks 16 | ------ 17 | 18 | Thanks to the following projects: 19 | 20 | - [Core Animation Programming Guide](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide/CoreAnimationBasics/CoreAnimationBasics.html#//apple_ref/doc/uid/TP40004514-CH2-SW3) 21 | - [WWDC2014 Building Interruptible and Responsive Interactions](https://developer.apple.com/videos/play/wwdc2014/236/) 22 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 140A8FD61CAA497E009CD16A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140A8FD51CAA497E009CD16A /* AppDelegate.swift */; }; 11 | 140A8FD81CAA497E009CD16A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140A8FD71CAA497E009CD16A /* ViewController.swift */; }; 12 | 140A8FDB1CAA497E009CD16A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 140A8FD91CAA497E009CD16A /* Main.storyboard */; }; 13 | 140A8FDD1CAA497E009CD16A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 140A8FDC1CAA497E009CD16A /* Assets.xcassets */; }; 14 | 140A8FE01CAA497E009CD16A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 140A8FDE1CAA497E009CD16A /* LaunchScreen.storyboard */; }; 15 | 140A8FE81CAA49BE009CD16A /* CustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140A8FE71CAA49BE009CD16A /* CustomView.swift */; }; 16 | 14AB3F9A1CABAC7100E6E972 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14AB3F991CABAC7100E6E972 /* CustomButton.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 140A8FD21CAA497E009CD16A /* Animation_Helper_API_Explained.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Animation_Helper_API_Explained.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 140A8FD51CAA497E009CD16A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 140A8FD71CAA497E009CD16A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 140A8FDA1CAA497E009CD16A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 140A8FDC1CAA497E009CD16A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 140A8FDF1CAA497E009CD16A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 140A8FE11CAA497E009CD16A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 140A8FE71CAA49BE009CD16A /* CustomView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomView.swift; sourceTree = ""; }; 28 | 14AB3F991CABAC7100E6E972 /* CustomButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 140A8FCF1CAA497E009CD16A /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 140A8FC91CAA497E009CD16A = { 43 | isa = PBXGroup; 44 | children = ( 45 | 140A8FD41CAA497E009CD16A /* Animation_Helper_API_Explained */, 46 | 140A8FD31CAA497E009CD16A /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 140A8FD31CAA497E009CD16A /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 140A8FD21CAA497E009CD16A /* Animation_Helper_API_Explained.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 140A8FD41CAA497E009CD16A /* Animation_Helper_API_Explained */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 140A8FD51CAA497E009CD16A /* AppDelegate.swift */, 62 | 140A8FD71CAA497E009CD16A /* ViewController.swift */, 63 | 140A8FE71CAA49BE009CD16A /* CustomView.swift */, 64 | 14AB3F991CABAC7100E6E972 /* CustomButton.swift */, 65 | 140A8FD91CAA497E009CD16A /* Main.storyboard */, 66 | 140A8FDC1CAA497E009CD16A /* Assets.xcassets */, 67 | 140A8FDE1CAA497E009CD16A /* LaunchScreen.storyboard */, 68 | 140A8FE11CAA497E009CD16A /* Info.plist */, 69 | ); 70 | path = Animation_Helper_API_Explained; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 140A8FD11CAA497E009CD16A /* Animation_Helper_API_Explained */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 140A8FE41CAA497E009CD16A /* Build configuration list for PBXNativeTarget "Animation_Helper_API_Explained" */; 79 | buildPhases = ( 80 | 140A8FCE1CAA497E009CD16A /* Sources */, 81 | 140A8FCF1CAA497E009CD16A /* Frameworks */, 82 | 140A8FD01CAA497E009CD16A /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = Animation_Helper_API_Explained; 89 | productName = Animation_Helper_API_Explained; 90 | productReference = 140A8FD21CAA497E009CD16A /* Animation_Helper_API_Explained.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 140A8FCA1CAA497E009CD16A /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 0720; 100 | LastUpgradeCheck = 0720; 101 | ORGANIZATIONNAME = Pigfly; 102 | TargetAttributes = { 103 | 140A8FD11CAA497E009CD16A = { 104 | CreatedOnToolsVersion = 7.2; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 140A8FCD1CAA497E009CD16A /* Build configuration list for PBXProject "Animation_Helper_API_Explained" */; 109 | compatibilityVersion = "Xcode 3.2"; 110 | developmentRegion = English; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 140A8FC91CAA497E009CD16A; 117 | productRefGroup = 140A8FD31CAA497E009CD16A /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 140A8FD11CAA497E009CD16A /* Animation_Helper_API_Explained */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 140A8FD01CAA497E009CD16A /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 140A8FE01CAA497E009CD16A /* LaunchScreen.storyboard in Resources */, 132 | 140A8FDD1CAA497E009CD16A /* Assets.xcassets in Resources */, 133 | 140A8FDB1CAA497E009CD16A /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 140A8FCE1CAA497E009CD16A /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 14AB3F9A1CABAC7100E6E972 /* CustomButton.swift in Sources */, 145 | 140A8FE81CAA49BE009CD16A /* CustomView.swift in Sources */, 146 | 140A8FD81CAA497E009CD16A /* ViewController.swift in Sources */, 147 | 140A8FD61CAA497E009CD16A /* AppDelegate.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | 140A8FD91CAA497E009CD16A /* Main.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | 140A8FDA1CAA497E009CD16A /* Base */, 158 | ); 159 | name = Main.storyboard; 160 | sourceTree = ""; 161 | }; 162 | 140A8FDE1CAA497E009CD16A /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | 140A8FDF1CAA497E009CD16A /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | 140A8FE21CAA497E009CD16A /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 178 | CLANG_CXX_LIBRARY = "libc++"; 179 | CLANG_ENABLE_MODULES = YES; 180 | CLANG_ENABLE_OBJC_ARC = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_CONSTANT_CONVERSION = YES; 183 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 184 | CLANG_WARN_EMPTY_BODY = YES; 185 | CLANG_WARN_ENUM_CONVERSION = YES; 186 | CLANG_WARN_INT_CONVERSION = YES; 187 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 188 | CLANG_WARN_UNREACHABLE_CODE = YES; 189 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 190 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 191 | COPY_PHASE_STRIP = NO; 192 | DEBUG_INFORMATION_FORMAT = dwarf; 193 | ENABLE_STRICT_OBJC_MSGSEND = YES; 194 | ENABLE_TESTABILITY = YES; 195 | GCC_C_LANGUAGE_STANDARD = gnu99; 196 | GCC_DYNAMIC_NO_PIC = NO; 197 | GCC_NO_COMMON_BLOCKS = YES; 198 | GCC_OPTIMIZATION_LEVEL = 0; 199 | GCC_PREPROCESSOR_DEFINITIONS = ( 200 | "DEBUG=1", 201 | "$(inherited)", 202 | ); 203 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 204 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 205 | GCC_WARN_UNDECLARED_SELECTOR = YES; 206 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 207 | GCC_WARN_UNUSED_FUNCTION = YES; 208 | GCC_WARN_UNUSED_VARIABLE = YES; 209 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 210 | MTL_ENABLE_DEBUG_INFO = YES; 211 | ONLY_ACTIVE_ARCH = YES; 212 | SDKROOT = iphoneos; 213 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 214 | }; 215 | name = Debug; 216 | }; 217 | 140A8FE31CAA497E009CD16A /* Release */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ALWAYS_SEARCH_USER_PATHS = NO; 221 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 222 | CLANG_CXX_LIBRARY = "libc++"; 223 | CLANG_ENABLE_MODULES = YES; 224 | CLANG_ENABLE_OBJC_ARC = YES; 225 | CLANG_WARN_BOOL_CONVERSION = YES; 226 | CLANG_WARN_CONSTANT_CONVERSION = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INT_CONVERSION = YES; 231 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 232 | CLANG_WARN_UNREACHABLE_CODE = YES; 233 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 234 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 235 | COPY_PHASE_STRIP = NO; 236 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 237 | ENABLE_NS_ASSERTIONS = NO; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | GCC_C_LANGUAGE_STANDARD = gnu99; 240 | GCC_NO_COMMON_BLOCKS = YES; 241 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 242 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 243 | GCC_WARN_UNDECLARED_SELECTOR = YES; 244 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 245 | GCC_WARN_UNUSED_FUNCTION = YES; 246 | GCC_WARN_UNUSED_VARIABLE = YES; 247 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 248 | MTL_ENABLE_DEBUG_INFO = NO; 249 | SDKROOT = iphoneos; 250 | VALIDATE_PRODUCT = YES; 251 | }; 252 | name = Release; 253 | }; 254 | 140A8FE51CAA497E009CD16A /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 258 | INFOPLIST_FILE = Animation_Helper_API_Explained/Info.plist; 259 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 260 | PRODUCT_BUNDLE_IDENTIFIER = "au.com.Pigfly.Alex.Animation-Helper-API-Explained"; 261 | PRODUCT_NAME = "$(TARGET_NAME)"; 262 | }; 263 | name = Debug; 264 | }; 265 | 140A8FE61CAA497E009CD16A /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 269 | INFOPLIST_FILE = Animation_Helper_API_Explained/Info.plist; 270 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 271 | PRODUCT_BUNDLE_IDENTIFIER = "au.com.Pigfly.Alex.Animation-Helper-API-Explained"; 272 | PRODUCT_NAME = "$(TARGET_NAME)"; 273 | }; 274 | name = Release; 275 | }; 276 | /* End XCBuildConfiguration section */ 277 | 278 | /* Begin XCConfigurationList section */ 279 | 140A8FCD1CAA497E009CD16A /* Build configuration list for PBXProject "Animation_Helper_API_Explained" */ = { 280 | isa = XCConfigurationList; 281 | buildConfigurations = ( 282 | 140A8FE21CAA497E009CD16A /* Debug */, 283 | 140A8FE31CAA497E009CD16A /* Release */, 284 | ); 285 | defaultConfigurationIsVisible = 0; 286 | defaultConfigurationName = Release; 287 | }; 288 | 140A8FE41CAA497E009CD16A /* Build configuration list for PBXNativeTarget "Animation_Helper_API_Explained" */ = { 289 | isa = XCConfigurationList; 290 | buildConfigurations = ( 291 | 140A8FE51CAA497E009CD16A /* Debug */, 292 | 140A8FE61CAA497E009CD16A /* Release */, 293 | ); 294 | defaultConfigurationIsVisible = 0; 295 | defaultConfigurationName = Release; 296 | }; 297 | /* End XCConfigurationList section */ 298 | }; 299 | rootObject = 140A8FCA1CAA497E009CD16A /* Project object */; 300 | } 301 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/project.xcworkspace/xcuserdata/alexjiang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pigfly/iOS_Core_Animation_tutorial/2a777449fcdb03adb23a396ae4eb6f8722e866d7/animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/project.xcworkspace/xcuserdata/alexjiang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/xcuserdata/alexjiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/xcuserdata/alexjiang.xcuserdatad/xcschemes/Animation_Helper_API_Explained.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 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained.xcodeproj/xcuserdata/alexjiang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Animation_Helper_API_Explained.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 140A8FD11CAA497E009CD16A 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Animation_Helper_API_Explained 4 | // 5 | // Created by Alex Jiang on 29/03/2016. 6 | // Copyright © 2016 Pigfly. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/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 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/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 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/CustomButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomButton.swift 3 | // Animation_Helper_API_Explained 4 | // 5 | // Created by Alex Jiang on 30/03/2016. 6 | // Copyright © 2016 Pigfly. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CustomButton: UIButton { 13 | override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? { 14 | let newPoint = self.layer.presentationLayer()!.convertPoint(point, fromLayer: layer) 15 | 16 | return super.hitTest(newPoint, withEvent: event) 17 | } 18 | } -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/CustomView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomView.swift 3 | // Animation_Helper_API_Explained 4 | // 5 | // Created by Alex Jiang on 29/03/2016. 6 | // Copyright © 2016 Pigfly. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CustomView: UIView { 13 | let demoView = CustomButton(type: .System) 14 | 15 | 16 | override init(frame: CGRect) { 17 | super.init(frame: frame) 18 | self.defaultInit() 19 | } 20 | 21 | 22 | required init?(coder aDecoder: NSCoder) { 23 | super.init(coder: aDecoder) 24 | self.defaultInit() 25 | } 26 | 27 | 28 | func defaultInit() { 29 | self.addSubview(demoView) 30 | 31 | demoView.setTitle("Demo click", forState: .Normal) 32 | demoView.frame = CGRectMake(0, 0, 100, 100) 33 | demoView.backgroundColor = UIColor.purpleColor() 34 | 35 | self.backgroundColor = UIColor.greenColor() 36 | 37 | UIView.animateWithDuration(5, delay: 0, options: [.CurveLinear, .AllowUserInteraction], 38 | animations: { () -> Void in 39 | self.backgroundColor = UIColor.grayColor() 40 | self.demoView.center = CGPointMake(200, 200) 41 | }) { (Bool) -> Void in 42 | self.demoView.center = CGPointMake(50, 50) 43 | } 44 | puts("foo bar") 45 | } 46 | 47 | 48 | } -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/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 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /animation_helper_API/Animation_Helper_API_Explained/Animation_Helper_API_Explained/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Animation_Helper_API_Explained 4 | // 5 | // Created by Alex Jiang on 29/03/2016. 6 | // Copyright © 2016 Pigfly. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | let customView = CustomView(frame: self.view.frame) 17 | self.view.addSubview(customView) 18 | } 19 | 20 | override func didReceiveMemoryWarning() { 21 | super.didReceiveMemoryWarning() 22 | // Dispose of any resources that can be recreated. 23 | } 24 | 25 | 26 | } 27 | 28 | --------------------------------------------------------------------------------