├── BKTransitionDemo ├── BKTransitionDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── bking.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── bking.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints.xcbkptlist │ │ └── xcschemes │ │ ├── BKTransitionDemo.xcscheme │ │ └── xcschememanagement.plist ├── BKTransitionDemo │ ├── BKTransitionDemo-Info.plist │ ├── BKTransitionDemo-Prefix.pch │ ├── BKTransitionDemoAppDelegate.h │ ├── BKTransitionDemoAppDelegate.m │ ├── BKViewController.h │ ├── BKViewController.m │ ├── CartoonViewController.h │ ├── CartoonViewController.m │ ├── CartoonViewController.xib │ ├── RootViewController.h │ ├── RootViewController.m │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── MainWindow.xib │ │ └── RootViewController.xib │ └── main.m └── Images │ ├── Face1.png │ ├── Face2.png │ └── Face3.png └── Classes ├── NSObject+Proxy.h ├── NSObject+Proxy.m ├── UINavigationController+CustomAnimation.h ├── UINavigationController+CustomAnimation.m ├── UIView+Transition.h └── UIView+Transition.m /BKTransitionDemo/BKTransitionDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 86260B2913574CB70040C9FA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86260B2813574CB70040C9FA /* UIKit.framework */; }; 11 | 86260B2B13574CB70040C9FA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86260B2A13574CB70040C9FA /* Foundation.framework */; }; 12 | 86260B2D13574CB70040C9FA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86260B2C13574CB70040C9FA /* CoreGraphics.framework */; }; 13 | 86260B3313574CB70040C9FA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 86260B3113574CB70040C9FA /* InfoPlist.strings */; }; 14 | 86260B3613574CB70040C9FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B3513574CB70040C9FA /* main.m */; }; 15 | 86260B3913574CB70040C9FA /* BKTransitionDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B3813574CB70040C9FA /* BKTransitionDemoAppDelegate.m */; }; 16 | 86260B3C13574CB70040C9FA /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 86260B3A13574CB70040C9FA /* MainWindow.xib */; }; 17 | 86260B3F13574CB70040C9FA /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B3E13574CB70040C9FA /* RootViewController.m */; }; 18 | 86260B4213574CB70040C9FA /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 86260B4013574CB70040C9FA /* RootViewController.xib */; }; 19 | 86260B4F13574CE00040C9FA /* UIView+Transition.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B4913574CE00040C9FA /* UIView+Transition.m */; }; 20 | 86260B5013574CE00040C9FA /* UINavigationController+CustomAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B4B13574CE00040C9FA /* UINavigationController+CustomAnimation.m */; }; 21 | 86260B5113574CE00040C9FA /* NSObject+Proxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B4D13574CE00040C9FA /* NSObject+Proxy.m */; }; 22 | 86260B5513574D3D0040C9FA /* BKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B5313574D3C0040C9FA /* BKViewController.m */; }; 23 | 86260B5B13574F2E0040C9FA /* Face3.png in Resources */ = {isa = PBXBuildFile; fileRef = 86260B5813574F2E0040C9FA /* Face3.png */; }; 24 | 86260B5C13574F2E0040C9FA /* Face2.png in Resources */ = {isa = PBXBuildFile; fileRef = 86260B5913574F2E0040C9FA /* Face2.png */; }; 25 | 86260B5D13574F2E0040C9FA /* Face1.png in Resources */ = {isa = PBXBuildFile; fileRef = 86260B5A13574F2E0040C9FA /* Face1.png */; }; 26 | 86260B61135751550040C9FA /* CartoonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86260B5F135751540040C9FA /* CartoonViewController.m */; }; 27 | 86260B62135751550040C9FA /* CartoonViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 86260B60135751550040C9FA /* CartoonViewController.xib */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 86260B2413574CB70040C9FA /* BKTransitionDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BKTransitionDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 86260B2813574CB70040C9FA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 33 | 86260B2A13574CB70040C9FA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 34 | 86260B2C13574CB70040C9FA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 35 | 86260B3013574CB70040C9FA /* BKTransitionDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BKTransitionDemo-Info.plist"; sourceTree = ""; }; 36 | 86260B3213574CB70040C9FA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 37 | 86260B3413574CB70040C9FA /* BKTransitionDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BKTransitionDemo-Prefix.pch"; sourceTree = ""; }; 38 | 86260B3513574CB70040C9FA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 39 | 86260B3713574CB70040C9FA /* BKTransitionDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BKTransitionDemoAppDelegate.h; sourceTree = ""; }; 40 | 86260B3813574CB70040C9FA /* BKTransitionDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BKTransitionDemoAppDelegate.m; sourceTree = ""; }; 41 | 86260B3B13574CB70040C9FA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 42 | 86260B3D13574CB70040C9FA /* RootViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 43 | 86260B3E13574CB70040C9FA /* RootViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 44 | 86260B4113574CB70040C9FA /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/RootViewController.xib; sourceTree = ""; }; 45 | 86260B4913574CE00040C9FA /* UIView+Transition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Transition.m"; path = "../Classes/UIView+Transition.m"; sourceTree = ""; }; 46 | 86260B4A13574CE00040C9FA /* UIView+Transition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Transition.h"; path = "../Classes/UIView+Transition.h"; sourceTree = ""; }; 47 | 86260B4B13574CE00040C9FA /* UINavigationController+CustomAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UINavigationController+CustomAnimation.m"; path = "../Classes/UINavigationController+CustomAnimation.m"; sourceTree = ""; }; 48 | 86260B4C13574CE00040C9FA /* UINavigationController+CustomAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UINavigationController+CustomAnimation.h"; path = "../Classes/UINavigationController+CustomAnimation.h"; sourceTree = ""; }; 49 | 86260B4D13574CE00040C9FA /* NSObject+Proxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+Proxy.m"; path = "../Classes/NSObject+Proxy.m"; sourceTree = ""; }; 50 | 86260B4E13574CE00040C9FA /* NSObject+Proxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+Proxy.h"; path = "../Classes/NSObject+Proxy.h"; sourceTree = ""; }; 51 | 86260B5213574D3C0040C9FA /* BKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKViewController.h; sourceTree = ""; }; 52 | 86260B5313574D3C0040C9FA /* BKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKViewController.m; sourceTree = ""; }; 53 | 86260B5813574F2E0040C9FA /* Face3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Face3.png; path = Images/Face3.png; sourceTree = ""; }; 54 | 86260B5913574F2E0040C9FA /* Face2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Face2.png; path = Images/Face2.png; sourceTree = ""; }; 55 | 86260B5A13574F2E0040C9FA /* Face1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Face1.png; path = Images/Face1.png; sourceTree = ""; }; 56 | 86260B5E135751540040C9FA /* CartoonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CartoonViewController.h; sourceTree = ""; }; 57 | 86260B5F135751540040C9FA /* CartoonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CartoonViewController.m; sourceTree = ""; }; 58 | 86260B60135751550040C9FA /* CartoonViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CartoonViewController.xib; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 86260B2113574CB70040C9FA /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 86260B2913574CB70040C9FA /* UIKit.framework in Frameworks */, 67 | 86260B2B13574CB70040C9FA /* Foundation.framework in Frameworks */, 68 | 86260B2D13574CB70040C9FA /* CoreGraphics.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | 86260B1913574CB70040C9FA = { 76 | isa = PBXGroup; 77 | children = ( 78 | 86260B5713574F1D0040C9FA /* Images */, 79 | 86260B4813574CD30040C9FA /* BKTransition */, 80 | 86260B2E13574CB70040C9FA /* BKTransitionDemo */, 81 | 86260B2713574CB70040C9FA /* Frameworks */, 82 | 86260B2513574CB70040C9FA /* Products */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | 86260B2513574CB70040C9FA /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 86260B2413574CB70040C9FA /* BKTransitionDemo.app */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | 86260B2713574CB70040C9FA /* Frameworks */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 86260B2813574CB70040C9FA /* UIKit.framework */, 98 | 86260B2A13574CB70040C9FA /* Foundation.framework */, 99 | 86260B2C13574CB70040C9FA /* CoreGraphics.framework */, 100 | ); 101 | name = Frameworks; 102 | sourceTree = ""; 103 | }; 104 | 86260B2E13574CB70040C9FA /* BKTransitionDemo */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 86260B3713574CB70040C9FA /* BKTransitionDemoAppDelegate.h */, 108 | 86260B3813574CB70040C9FA /* BKTransitionDemoAppDelegate.m */, 109 | 86260B3A13574CB70040C9FA /* MainWindow.xib */, 110 | 86260B3D13574CB70040C9FA /* RootViewController.h */, 111 | 86260B3E13574CB70040C9FA /* RootViewController.m */, 112 | 86260B4013574CB70040C9FA /* RootViewController.xib */, 113 | 86260B2F13574CB70040C9FA /* Supporting Files */, 114 | 86260B5213574D3C0040C9FA /* BKViewController.h */, 115 | 86260B5313574D3C0040C9FA /* BKViewController.m */, 116 | 86260B5E135751540040C9FA /* CartoonViewController.h */, 117 | 86260B5F135751540040C9FA /* CartoonViewController.m */, 118 | 86260B60135751550040C9FA /* CartoonViewController.xib */, 119 | ); 120 | path = BKTransitionDemo; 121 | sourceTree = ""; 122 | }; 123 | 86260B2F13574CB70040C9FA /* Supporting Files */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 86260B3013574CB70040C9FA /* BKTransitionDemo-Info.plist */, 127 | 86260B3113574CB70040C9FA /* InfoPlist.strings */, 128 | 86260B3413574CB70040C9FA /* BKTransitionDemo-Prefix.pch */, 129 | 86260B3513574CB70040C9FA /* main.m */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | 86260B4813574CD30040C9FA /* BKTransition */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 86260B4913574CE00040C9FA /* UIView+Transition.m */, 138 | 86260B4A13574CE00040C9FA /* UIView+Transition.h */, 139 | 86260B4B13574CE00040C9FA /* UINavigationController+CustomAnimation.m */, 140 | 86260B4C13574CE00040C9FA /* UINavigationController+CustomAnimation.h */, 141 | 86260B4D13574CE00040C9FA /* NSObject+Proxy.m */, 142 | 86260B4E13574CE00040C9FA /* NSObject+Proxy.h */, 143 | ); 144 | name = BKTransition; 145 | sourceTree = ""; 146 | }; 147 | 86260B5713574F1D0040C9FA /* Images */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 86260B5813574F2E0040C9FA /* Face3.png */, 151 | 86260B5913574F2E0040C9FA /* Face2.png */, 152 | 86260B5A13574F2E0040C9FA /* Face1.png */, 153 | ); 154 | name = Images; 155 | sourceTree = ""; 156 | }; 157 | /* End PBXGroup section */ 158 | 159 | /* Begin PBXNativeTarget section */ 160 | 86260B2313574CB70040C9FA /* BKTransitionDemo */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = 86260B4513574CB70040C9FA /* Build configuration list for PBXNativeTarget "BKTransitionDemo" */; 163 | buildPhases = ( 164 | 86260B2013574CB70040C9FA /* Sources */, 165 | 86260B2113574CB70040C9FA /* Frameworks */, 166 | 86260B2213574CB70040C9FA /* Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = BKTransitionDemo; 173 | productName = BKTransitionDemo; 174 | productReference = 86260B2413574CB70040C9FA /* BKTransitionDemo.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | 86260B1B13574CB70040C9FA /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | ORGANIZATIONNAME = "King Software Design"; 184 | }; 185 | buildConfigurationList = 86260B1E13574CB70040C9FA /* Build configuration list for PBXProject "BKTransitionDemo" */; 186 | compatibilityVersion = "Xcode 3.2"; 187 | developmentRegion = English; 188 | hasScannedForEncodings = 0; 189 | knownRegions = ( 190 | en, 191 | ); 192 | mainGroup = 86260B1913574CB70040C9FA; 193 | productRefGroup = 86260B2513574CB70040C9FA /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | 86260B2313574CB70040C9FA /* BKTransitionDemo */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | 86260B2213574CB70040C9FA /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 86260B3313574CB70040C9FA /* InfoPlist.strings in Resources */, 208 | 86260B3C13574CB70040C9FA /* MainWindow.xib in Resources */, 209 | 86260B4213574CB70040C9FA /* RootViewController.xib in Resources */, 210 | 86260B5B13574F2E0040C9FA /* Face3.png in Resources */, 211 | 86260B5C13574F2E0040C9FA /* Face2.png in Resources */, 212 | 86260B5D13574F2E0040C9FA /* Face1.png in Resources */, 213 | 86260B62135751550040C9FA /* CartoonViewController.xib in Resources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | /* End PBXResourcesBuildPhase section */ 218 | 219 | /* Begin PBXSourcesBuildPhase section */ 220 | 86260B2013574CB70040C9FA /* Sources */ = { 221 | isa = PBXSourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 86260B3613574CB70040C9FA /* main.m in Sources */, 225 | 86260B3913574CB70040C9FA /* BKTransitionDemoAppDelegate.m in Sources */, 226 | 86260B3F13574CB70040C9FA /* RootViewController.m in Sources */, 227 | 86260B4F13574CE00040C9FA /* UIView+Transition.m in Sources */, 228 | 86260B5013574CE00040C9FA /* UINavigationController+CustomAnimation.m in Sources */, 229 | 86260B5113574CE00040C9FA /* NSObject+Proxy.m in Sources */, 230 | 86260B5513574D3D0040C9FA /* BKViewController.m in Sources */, 231 | 86260B61135751550040C9FA /* CartoonViewController.m in Sources */, 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXSourcesBuildPhase section */ 236 | 237 | /* Begin PBXVariantGroup section */ 238 | 86260B3113574CB70040C9FA /* InfoPlist.strings */ = { 239 | isa = PBXVariantGroup; 240 | children = ( 241 | 86260B3213574CB70040C9FA /* en */, 242 | ); 243 | name = InfoPlist.strings; 244 | sourceTree = ""; 245 | }; 246 | 86260B3A13574CB70040C9FA /* MainWindow.xib */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | 86260B3B13574CB70040C9FA /* en */, 250 | ); 251 | name = MainWindow.xib; 252 | sourceTree = ""; 253 | }; 254 | 86260B4013574CB70040C9FA /* RootViewController.xib */ = { 255 | isa = PBXVariantGroup; 256 | children = ( 257 | 86260B4113574CB70040C9FA /* en */, 258 | ); 259 | name = RootViewController.xib; 260 | sourceTree = ""; 261 | }; 262 | /* End PBXVariantGroup section */ 263 | 264 | /* Begin XCBuildConfiguration section */ 265 | 86260B4313574CB70040C9FA /* Debug */ = { 266 | isa = XCBuildConfiguration; 267 | buildSettings = { 268 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 269 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 270 | GCC_C_LANGUAGE_STANDARD = gnu99; 271 | GCC_OPTIMIZATION_LEVEL = 0; 272 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 273 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 274 | GCC_VERSION = com.apple.compilers.llvmgcc42; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 278 | SDKROOT = iphoneos; 279 | }; 280 | name = Debug; 281 | }; 282 | 86260B4413574CB70040C9FA /* Release */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 286 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 287 | GCC_C_LANGUAGE_STANDARD = gnu99; 288 | GCC_VERSION = com.apple.compilers.llvmgcc42; 289 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 290 | GCC_WARN_UNUSED_VARIABLE = YES; 291 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 292 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 293 | SDKROOT = iphoneos; 294 | }; 295 | name = Release; 296 | }; 297 | 86260B4613574CB70040C9FA /* Debug */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | COPY_PHASE_STRIP = NO; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 304 | GCC_PREFIX_HEADER = "BKTransitionDemo/BKTransitionDemo-Prefix.pch"; 305 | INFOPLIST_FILE = "BKTransitionDemo/BKTransitionDemo-Info.plist"; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | WRAPPER_EXTENSION = app; 308 | }; 309 | name = Debug; 310 | }; 311 | 86260B4713574CB70040C9FA /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | COPY_PHASE_STRIP = YES; 316 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 317 | GCC_PREFIX_HEADER = "BKTransitionDemo/BKTransitionDemo-Prefix.pch"; 318 | INFOPLIST_FILE = "BKTransitionDemo/BKTransitionDemo-Info.plist"; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | VALIDATE_PRODUCT = YES; 321 | WRAPPER_EXTENSION = app; 322 | }; 323 | name = Release; 324 | }; 325 | /* End XCBuildConfiguration section */ 326 | 327 | /* Begin XCConfigurationList section */ 328 | 86260B1E13574CB70040C9FA /* Build configuration list for PBXProject "BKTransitionDemo" */ = { 329 | isa = XCConfigurationList; 330 | buildConfigurations = ( 331 | 86260B4313574CB70040C9FA /* Debug */, 332 | 86260B4413574CB70040C9FA /* Release */, 333 | ); 334 | defaultConfigurationIsVisible = 0; 335 | defaultConfigurationName = Release; 336 | }; 337 | 86260B4513574CB70040C9FA /* Build configuration list for PBXNativeTarget "BKTransitionDemo" */ = { 338 | isa = XCConfigurationList; 339 | buildConfigurations = ( 340 | 86260B4613574CB70040C9FA /* Debug */, 341 | 86260B4713574CB70040C9FA /* Release */, 342 | ); 343 | defaultConfigurationIsVisible = 0; 344 | }; 345 | /* End XCConfigurationList section */ 346 | }; 347 | rootObject = 86260B1B13574CB70040C9FA /* Project object */; 348 | } 349 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo.xcodeproj/project.xcworkspace/xcuserdata/bking.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo.xcodeproj/xcuserdata/bking.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo.xcodeproj/xcuserdata/bking.xcuserdatad/xcschemes/BKTransitionDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo.xcodeproj/xcuserdata/bking.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BKTransitionDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 86260B2313574CB70040C9FA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKTransitionDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.ksd.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKTransitionDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'BKTransitionDemo' target in the 'BKTransitionDemo' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKTransitionDemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // BKTransitionDemoAppDelegate.h 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BKTransitionDemoAppDelegate : NSObject { 12 | 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKTransitionDemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // BKTransitionDemoAppDelegate.m 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "BKTransitionDemoAppDelegate.h" 10 | 11 | @implementation BKTransitionDemoAppDelegate 12 | 13 | 14 | @synthesize window=_window; 15 | 16 | @synthesize navigationController=_navigationController; 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | // Override point for customization after application launch. 21 | // Add the navigation controller's view to the window and display. 22 | self.window.rootViewController = self.navigationController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | /* 30 | 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. 31 | 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. 32 | */ 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application 36 | { 37 | /* 38 | 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. 39 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | */ 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application 44 | { 45 | /* 46 | 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. 47 | */ 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | /* 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 | { 59 | /* 60 | Called when the application is about to terminate. 61 | Save data if appropriate. 62 | See also applicationDidEnterBackground:. 63 | */ 64 | } 65 | 66 | - (void)dealloc 67 | { 68 | [_window release]; 69 | [_navigationController release]; 70 | [super dealloc]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BKImagePassingViewController.h 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UINavigationController+CustomAnimation.h" 11 | 12 | 13 | @interface BKViewController : UIViewController { 14 | 15 | } 16 | - (void) nextTransitionType; 17 | - (void) pushController:(UIViewController*)controller; 18 | - (void) popController; 19 | 20 | // To be implemented by base classes 21 | - (CGRect) locationForTransitionImageInView:(UIView*)inView; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/BKViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BKImagePassingViewController.m 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "BKViewController.h" 10 | static NSUInteger mode = 0; 11 | 12 | @implementation BKViewController 13 | - (void) updateTitle { 14 | if (mode == 0) { 15 | self.title = @"Normal"; 16 | } else if (mode == 1) { 17 | self.title = @"Vertical Slide"; 18 | } else if (mode == 2) { 19 | self.title = @"Horizontal Slide"; 20 | } else if (mode == 3) { 21 | self.title = @"Curl Transition"; 22 | } else if (mode == 4) { 23 | self.title = @"Flip Transition"; 24 | } else if (mode == 5) { 25 | self.title = @"Custom Transition"; 26 | } 27 | } 28 | - (void) nextTransitionType { 29 | mode++; 30 | if (mode > 5) mode = 0; 31 | [self updateTitle]; 32 | } 33 | - (void) pushController:(UIViewController*)controller { 34 | if (mode == 0) { 35 | [self.navigationController pushViewController:controller animated:YES]; 36 | } else if (mode == 1) { 37 | [self.navigationController pushViewController:controller slide:BKSlideDirectionUp]; 38 | } else if (mode == 2) { 39 | [self.navigationController pushViewController:controller slide:BKSlideDirectionLeft]; 40 | } else if (mode == 3) { 41 | [self.navigationController pushViewController:controller animation:UIViewAnimationOptionTransitionCurlUp]; 42 | } else if (mode == 4) { 43 | [self.navigationController pushViewController:controller animation:UIViewAnimationOptionTransitionFlipFromLeft]; 44 | } else if (mode == 5) { 45 | [self.navigationController pushViewControllerCustomAnimation:controller]; 46 | } 47 | } 48 | - (void) popController { 49 | if (mode == 0) { 50 | [self.navigationController popViewControllerAnimated:YES]; 51 | } else if (mode == 1) { 52 | [self.navigationController popViewControllerSlide:BKSlideDirectionDown]; 53 | } else if (mode == 2) { 54 | [self.navigationController popViewControllerSlide:BKSlideDirectionRight]; 55 | } else if (mode == 3) { 56 | [self.navigationController popViewControllerAnimation:UIViewAnimationOptionTransitionCurlDown]; 57 | } else if (mode == 4) { 58 | [self.navigationController popViewControllerAnimation:UIViewAnimationOptionTransitionFlipFromRight]; 59 | } else if (mode == 5) { 60 | [self.navigationController popViewControllerCustomAnimation]; 61 | } 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/CartoonViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CartoonViewController.h 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BKViewController.h" 11 | 12 | 13 | @interface CartoonViewController : BKViewController { 14 | 15 | IBOutlet UIImageView *_imageView; 16 | } 17 | - (void) setCartoonImage:(UIImage*)image; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/CartoonViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CartoonViewController.m 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "CartoonViewController.h" 10 | 11 | 12 | @implementation CartoonViewController 13 | 14 | - (void) animateTransitionEnterFrom:(BKViewController*)fromViewController { 15 | CGRect originalPosition = _imageView.frame; 16 | _imageView.frame = [fromViewController locationForTransitionImageInView:self.view]; 17 | [UIView animateWithDuration:.5 animations:^(void) { 18 | _imageView.frame = originalPosition; 19 | } completion:^(BOOL finished) { 20 | [self.navigationController animationComplete]; 21 | 22 | }]; 23 | } 24 | 25 | - (void) animateTransitionExitTo:(BKViewController*)fromViewController { 26 | CGRect originalPosition = _imageView.frame; 27 | [UIView animateWithDuration:.5 animations:^(void) { 28 | _imageView.frame = [fromViewController locationForTransitionImageInView:self.view]; 29 | } completion:^(BOOL finished) { 30 | _imageView.frame = originalPosition; 31 | [self.navigationController animationComplete]; 32 | }]; 33 | } 34 | 35 | 36 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 37 | { 38 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 39 | if (self) { 40 | // Custom initialization 41 | } 42 | return self; 43 | } 44 | 45 | - (void)dealloc 46 | { 47 | [_imageView release]; 48 | [super dealloc]; 49 | } 50 | 51 | - (void)didReceiveMemoryWarning 52 | { 53 | // Releases the view if it doesn't have a superview. 54 | [super didReceiveMemoryWarning]; 55 | 56 | // Release any cached data, images, etc that aren't in use. 57 | } 58 | - (void) setCartoonImage:(UIImage*)image { 59 | _imageView.image = image; 60 | } 61 | #pragma mark - View lifecycle 62 | 63 | - (void)viewDidLoad 64 | { 65 | [super viewDidLoad]; 66 | self.navigationItem.leftBarButtonItem = 67 | [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone 68 | target:self 69 | action:@selector(popController)] autorelease]; 70 | } 71 | 72 | - (void)viewDidUnload 73 | { 74 | [_imageView release]; 75 | _imageView = nil; 76 | [super viewDidUnload]; 77 | // Release any retained subviews of the main view. 78 | // e.g. self.myOutlet = nil; 79 | } 80 | 81 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 82 | { 83 | // Return YES for supported orientations 84 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/CartoonViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J567 6 | 1306 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBUITextView 16 | IBUIImageView 17 | IBUIView 18 | IBProxyObject 19 | 20 | 21 | YES 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | YES 26 | 27 | YES 28 | 29 | 30 | 31 | 32 | YES 33 | 34 | IBFilesOwner 35 | IBCocoaTouchFramework 36 | 37 | 38 | IBFirstResponder 39 | IBCocoaTouchFramework 40 | 41 | 42 | 43 | 274 44 | 45 | YES 46 | 47 | 48 | 274 49 | {{34, 27}, {252, 252}} 50 | 51 | 52 | 1 53 | NO 54 | IBCocoaTouchFramework 55 | 56 | 57 | 58 | 292 59 | {{40, 312}, {240, 128}} 60 | 61 | 62 | 63 | 1 64 | MSAxIDEAA 65 | 66 | YES 67 | YES 68 | IBCocoaTouchFramework 69 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 70 | 71 | Helvetica 72 | 17 73 | 16 74 | 75 | 76 | 2 77 | IBCocoaTouchFramework 78 | 79 | 80 | 81 | {{0, 20}, {320, 460}} 82 | 83 | 84 | 85 | 86 | 3 87 | MQA 88 | 89 | 2 90 | 91 | 92 | 93 | IBCocoaTouchFramework 94 | 95 | 96 | 97 | 98 | YES 99 | 100 | 101 | view 102 | 103 | 104 | 105 | 3 106 | 107 | 108 | 109 | _imageView 110 | 111 | 112 | 113 | 6 114 | 115 | 116 | 117 | 118 | YES 119 | 120 | 0 121 | 122 | 123 | 124 | 125 | 126 | 1 127 | 128 | 129 | YES 130 | 131 | 132 | 133 | 134 | 135 | 136 | -1 137 | 138 | 139 | File's Owner 140 | 141 | 142 | -2 143 | 144 | 145 | 146 | 147 | 4 148 | 149 | 150 | 151 | 152 | 5 153 | 154 | 155 | 156 | 157 | 158 | 159 | YES 160 | 161 | YES 162 | -1.CustomClassName 163 | -2.CustomClassName 164 | 1.IBEditorWindowLastContentRect 165 | 1.IBPluginDependency 166 | 4.IBPluginDependency 167 | 5.IBPluginDependency 168 | 169 | 170 | YES 171 | CartoonViewController 172 | UIResponder 173 | {{556, 412}, {320, 480}} 174 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 175 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 176 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 177 | 178 | 179 | 180 | YES 181 | 182 | 183 | 184 | 185 | 186 | YES 187 | 188 | 189 | 190 | 191 | 6 192 | 193 | 194 | 195 | YES 196 | 197 | BKViewController 198 | UIViewController 199 | 200 | IBProjectSource 201 | ./Classes/BKViewController.h 202 | 203 | 204 | 205 | CartoonViewController 206 | BKViewController 207 | 208 | _imageView 209 | UIImageView 210 | 211 | 212 | _imageView 213 | 214 | _imageView 215 | UIImageView 216 | 217 | 218 | 219 | IBProjectSource 220 | ./Classes/CartoonViewController.h 221 | 222 | 223 | 224 | 225 | 0 226 | IBCocoaTouchFramework 227 | 228 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 229 | 230 | 231 | YES 232 | 3 233 | 301 234 | 235 | 236 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BKViewController.h" 11 | #import "CartoonViewController.h" 12 | 13 | @interface RootViewController : BKViewController { 14 | NSUInteger _selectedRow; 15 | UIImageView *_transtitioningImage; 16 | IBOutlet CartoonViewController *_cartoonController; 17 | } 18 | 19 | @property (nonatomic, readonly) UITableView *tableView; 20 | @end 21 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/RootViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.m 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "RootViewController.h" 10 | #import "UINavigationController+CustomAnimation.h" 11 | 12 | @implementation RootViewController 13 | 14 | - (void) animateTransitionEnterFrom:(BKViewController*)fromViewController { 15 | NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:_selectedRow inSection:0]; 16 | 17 | // Create an ImageView in the navigation controller view 18 | UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:selectedIndexPath]; 19 | CGRect originalFrame = cell.imageView.frame; 20 | 21 | _transtitioningImage.image = cell.imageView.image; 22 | _transtitioningImage.frame = [self.navigationController.view convertRect:originalFrame 23 | fromView:[cell.imageView superview]]; 24 | 25 | 26 | [self.navigationController.view addSubview:_transtitioningImage]; 27 | 28 | 29 | self.tableView.alpha = 0.0f; 30 | [UIView animateWithDuration:.5 animations:^(void) { 31 | 32 | self.tableView.alpha = 1.0f; 33 | 34 | } completion:^(BOOL finished) { 35 | 36 | [_transtitioningImage removeFromSuperview]; 37 | 38 | [self.navigationController animationComplete]; 39 | }]; 40 | 41 | } 42 | 43 | - (void) animateTransitionExitTo:(BKViewController*)toViewController { 44 | NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:_selectedRow inSection:0]; 45 | 46 | // Create an ImageView in the navigation controller view 47 | UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:selectedIndexPath]; 48 | CGRect originalFrame = cell.imageView.frame; 49 | 50 | _transtitioningImage.image = cell.imageView.image; 51 | _transtitioningImage.frame = [self.navigationController.view convertRect:originalFrame 52 | fromView:[cell.imageView superview]]; 53 | 54 | 55 | [self.navigationController.view addSubview:_transtitioningImage]; 56 | 57 | 58 | [UIView animateWithDuration:.5 animations:^(void) { 59 | self.tableView.alpha = 0.0f; 60 | 61 | } completion:^(BOOL finished) { 62 | 63 | self.tableView.alpha = 1.0f; 64 | [_transtitioningImage removeFromSuperview]; 65 | 66 | [self.navigationController animationComplete]; 67 | }]; 68 | } 69 | 70 | - (CGRect) locationForTransitionImageInView:(UIView*)inView { 71 | return [inView convertRect:_transtitioningImage.frame 72 | fromView:[_transtitioningImage superview]]; 73 | } 74 | 75 | 76 | 77 | - (UITableView*) tableView { 78 | return (UITableView*) self.view; 79 | } 80 | 81 | - (void)viewDidLoad 82 | { 83 | [super viewDidLoad]; 84 | self.tableView.rowHeight = 132; 85 | self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay 86 | target:self 87 | action:@selector(nextTransitionType)] autorelease]; 88 | _transtitioningImage = [[UIImageView alloc] initWithImage:nil]; 89 | 90 | self.title = @"Custom"; 91 | } 92 | 93 | // Customize the number of sections in the table view. 94 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 95 | { 96 | return 1; 97 | } 98 | 99 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 100 | { 101 | return 3; 102 | } 103 | 104 | // Customize the appearance of table view cells. 105 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 106 | { 107 | static NSString *CellIdentifier = @"Cell"; 108 | 109 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 110 | if (cell == nil) { 111 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 112 | } 113 | cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"Face%d", indexPath.row + 1]]; 114 | cell.textLabel.text = [NSString stringWithFormat:@"Cartoon %d", indexPath.row + 1]; 115 | 116 | // Configure the cell. 117 | return cell; 118 | } 119 | 120 | 121 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 122 | { 123 | _selectedRow = indexPath.row; 124 | _cartoonController.view; 125 | [_cartoonController setCartoonImage:[UIImage imageNamed:[NSString stringWithFormat:@"Face%d", indexPath.row + 1]]]; 126 | 127 | [self pushController:_cartoonController]; 128 | } 129 | 130 | 131 | - (void)viewDidUnload 132 | { 133 | [_transtitioningImage release]; 134 | _transtitioningImage = nil; 135 | [_cartoonController release]; 136 | _cartoonController = nil; 137 | [super viewDidUnload]; 138 | 139 | // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. 140 | // For example: self.myOutlet = nil; 141 | } 142 | 143 | - (void)dealloc 144 | { 145 | [_transtitioningImage release]; 146 | [_cartoonController release]; 147 | [super dealloc]; 148 | } 149 | 150 | @end 151 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | 45 | 1316 46 | 47 | {320, 480} 48 | 49 | 1 50 | MSAxIDEAA 51 | 52 | NO 53 | NO 54 | 55 | IBCocoaTouchFramework 56 | YES 57 | 58 | 59 | 60 | 61 | 1 62 | 63 | IBCocoaTouchFramework 64 | NO 65 | 66 | 67 | 256 68 | {0, 0} 69 | NO 70 | YES 71 | YES 72 | IBCocoaTouchFramework 73 | 74 | 75 | YES 76 | 77 | 78 | 79 | IBCocoaTouchFramework 80 | 81 | 82 | RootViewController 83 | 84 | 85 | 1 86 | 87 | IBCocoaTouchFramework 88 | NO 89 | 90 | 91 | 92 | 93 | 94 | 95 | YES 96 | 97 | 98 | delegate 99 | 100 | 101 | 102 | 4 103 | 104 | 105 | 106 | window 107 | 108 | 109 | 110 | 5 111 | 112 | 113 | 114 | navigationController 115 | 116 | 117 | 118 | 15 119 | 120 | 121 | 122 | 123 | YES 124 | 125 | 0 126 | 127 | 128 | 129 | 130 | 131 | 2 132 | 133 | 134 | YES 135 | 136 | 137 | 138 | 139 | -1 140 | 141 | 142 | File's Owner 143 | 144 | 145 | 3 146 | 147 | 148 | 149 | 150 | -2 151 | 152 | 153 | 154 | 155 | 9 156 | 157 | 158 | YES 159 | 160 | 161 | 162 | 163 | 164 | 165 | 11 166 | 167 | 168 | 169 | 170 | 13 171 | 172 | 173 | YES 174 | 175 | 176 | 177 | 178 | 179 | 14 180 | 181 | 182 | 183 | 184 | 185 | 186 | YES 187 | 188 | YES 189 | -1.CustomClassName 190 | -2.CustomClassName 191 | 11.IBPluginDependency 192 | 13.CustomClassName 193 | 13.IBPluginDependency 194 | 2.IBAttributePlaceholdersKey 195 | 2.IBEditorWindowLastContentRect 196 | 2.IBPluginDependency 197 | 3.CustomClassName 198 | 3.IBPluginDependency 199 | 9.IBEditorWindowLastContentRect 200 | 9.IBPluginDependency 201 | 202 | 203 | YES 204 | UIApplication 205 | UIResponder 206 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 207 | RootViewController 208 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 209 | 210 | YES 211 | 212 | 213 | YES 214 | 215 | 216 | {{673, 376}, {320, 480}} 217 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 218 | BKTransitionDemoAppDelegate 219 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 220 | {{186, 376}, {320, 480}} 221 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 222 | 223 | 224 | 225 | YES 226 | 227 | 228 | YES 229 | 230 | 231 | 232 | 233 | YES 234 | 235 | 236 | YES 237 | 238 | 239 | 240 | 16 241 | 242 | 243 | 244 | YES 245 | 246 | RootViewController 247 | UITableViewController 248 | 249 | IBProjectSource 250 | RootViewController.h 251 | 252 | 253 | 254 | UIWindow 255 | UIView 256 | 257 | IBUserSource 258 | 259 | 260 | 261 | 262 | BKTransitionDemoAppDelegate 263 | NSObject 264 | 265 | YES 266 | 267 | YES 268 | navigationController 269 | window 270 | 271 | 272 | YES 273 | UINavigationController 274 | UIWindow 275 | 276 | 277 | 278 | YES 279 | 280 | YES 281 | navigationController 282 | window 283 | 284 | 285 | YES 286 | 287 | navigationController 288 | UINavigationController 289 | 290 | 291 | window 292 | UIWindow 293 | 294 | 295 | 296 | 297 | IBProjectSource 298 | BKTransitionDemoAppDelegate.h 299 | 300 | 301 | 302 | 303 | YES 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSError.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSFileManager.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | Foundation.framework/Headers/NSKeyValueCoding.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | Foundation.framework/Headers/NSKeyValueObserving.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | Foundation.framework/Headers/NSKeyedArchiver.h 337 | 338 | 339 | 340 | NSObject 341 | 342 | IBFrameworkSource 343 | Foundation.framework/Headers/NSObject.h 344 | 345 | 346 | 347 | NSObject 348 | 349 | IBFrameworkSource 350 | Foundation.framework/Headers/NSRunLoop.h 351 | 352 | 353 | 354 | NSObject 355 | 356 | IBFrameworkSource 357 | Foundation.framework/Headers/NSThread.h 358 | 359 | 360 | 361 | NSObject 362 | 363 | IBFrameworkSource 364 | Foundation.framework/Headers/NSURL.h 365 | 366 | 367 | 368 | NSObject 369 | 370 | IBFrameworkSource 371 | Foundation.framework/Headers/NSURLConnection.h 372 | 373 | 374 | 375 | NSObject 376 | 377 | IBFrameworkSource 378 | UIKit.framework/Headers/UIAccessibility.h 379 | 380 | 381 | 382 | NSObject 383 | 384 | IBFrameworkSource 385 | UIKit.framework/Headers/UINibLoading.h 386 | 387 | 388 | 389 | NSObject 390 | 391 | IBFrameworkSource 392 | UIKit.framework/Headers/UIResponder.h 393 | 394 | 395 | 396 | UIApplication 397 | UIResponder 398 | 399 | IBFrameworkSource 400 | UIKit.framework/Headers/UIApplication.h 401 | 402 | 403 | 404 | UIBarButtonItem 405 | UIBarItem 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UIBarButtonItem.h 409 | 410 | 411 | 412 | UIBarItem 413 | NSObject 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIBarItem.h 417 | 418 | 419 | 420 | UINavigationBar 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UINavigationBar.h 425 | 426 | 427 | 428 | UINavigationController 429 | UIViewController 430 | 431 | IBFrameworkSource 432 | UIKit.framework/Headers/UINavigationController.h 433 | 434 | 435 | 436 | UINavigationItem 437 | NSObject 438 | 439 | 440 | 441 | UIResponder 442 | NSObject 443 | 444 | 445 | 446 | UISearchBar 447 | UIView 448 | 449 | IBFrameworkSource 450 | UIKit.framework/Headers/UISearchBar.h 451 | 452 | 453 | 454 | UISearchDisplayController 455 | NSObject 456 | 457 | IBFrameworkSource 458 | UIKit.framework/Headers/UISearchDisplayController.h 459 | 460 | 461 | 462 | UITableViewController 463 | UIViewController 464 | 465 | IBFrameworkSource 466 | UIKit.framework/Headers/UITableViewController.h 467 | 468 | 469 | 470 | UIView 471 | 472 | IBFrameworkSource 473 | UIKit.framework/Headers/UITextField.h 474 | 475 | 476 | 477 | UIView 478 | UIResponder 479 | 480 | IBFrameworkSource 481 | UIKit.framework/Headers/UIView.h 482 | 483 | 484 | 485 | UIViewController 486 | 487 | 488 | 489 | UIViewController 490 | 491 | IBFrameworkSource 492 | UIKit.framework/Headers/UIPopoverController.h 493 | 494 | 495 | 496 | UIViewController 497 | 498 | IBFrameworkSource 499 | UIKit.framework/Headers/UISplitViewController.h 500 | 501 | 502 | 503 | UIViewController 504 | 505 | IBFrameworkSource 506 | UIKit.framework/Headers/UITabBarController.h 507 | 508 | 509 | 510 | UIViewController 511 | UIResponder 512 | 513 | IBFrameworkSource 514 | UIKit.framework/Headers/UIViewController.h 515 | 516 | 517 | 518 | UIWindow 519 | UIView 520 | 521 | IBFrameworkSource 522 | UIKit.framework/Headers/UIWindow.h 523 | 524 | 525 | 526 | 527 | 0 528 | IBCocoaTouchFramework 529 | 530 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 531 | 532 | 533 | 534 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 535 | 536 | 537 | YES 538 | BKTransitionDemo.xcodeproj 539 | 3 540 | 112 541 | 542 | 543 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/en.lproj/RootViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 784 5 | 10J567 6 | 1306 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 301 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUIViewController 17 | IBUITableView 18 | 19 | 20 | YES 21 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 22 | 23 | 24 | YES 25 | 26 | YES 27 | 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | {320, 247} 44 | 45 | 46 | 47 | 48 | 3 49 | MQA 50 | 51 | NO 52 | YES 53 | NO 54 | 55 | 3 56 | 3 57 | 58 | IBCocoaTouchFramework 59 | NO 60 | 1 61 | 0 62 | YES 63 | 44 64 | 22 65 | 22 66 | 67 | 68 | CartoonViewController 69 | 70 | 71 | 1 72 | 1 73 | 74 | IBCocoaTouchFramework 75 | NO 76 | 77 | 78 | 79 | 80 | YES 81 | 82 | 83 | view 84 | 85 | 86 | 87 | 3 88 | 89 | 90 | 91 | dataSource 92 | 93 | 94 | 95 | 4 96 | 97 | 98 | 99 | delegate 100 | 101 | 102 | 103 | 5 104 | 105 | 106 | 107 | _cartoonController 108 | 109 | 110 | 111 | 7 112 | 113 | 114 | 115 | 116 | YES 117 | 118 | 0 119 | 120 | 121 | 122 | 123 | 124 | -1 125 | 126 | 127 | File's Owner 128 | 129 | 130 | -2 131 | 132 | 133 | 134 | 135 | 2 136 | 137 | 138 | 139 | 140 | 6 141 | 142 | 143 | 144 | 145 | 146 | 147 | YES 148 | 149 | YES 150 | -1.CustomClassName 151 | -2.CustomClassName 152 | 2.IBEditorWindowLastContentRect 153 | 2.IBPluginDependency 154 | 6.CustomClassName 155 | 6.IBPluginDependency 156 | 157 | 158 | YES 159 | RootViewController 160 | UIResponder 161 | {{144, 609}, {320, 247}} 162 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 163 | CartoonViewController 164 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 165 | 166 | 167 | 168 | YES 169 | 170 | 171 | 172 | 173 | 174 | YES 175 | 176 | 177 | 178 | 179 | 7 180 | 181 | 182 | 183 | YES 184 | 185 | BKViewController 186 | UIViewController 187 | 188 | IBProjectSource 189 | ./Classes/BKViewController.h 190 | 191 | 192 | 193 | CartoonViewController 194 | BKViewController 195 | 196 | _imageView 197 | UIImageView 198 | 199 | 200 | _imageView 201 | 202 | _imageView 203 | UIImageView 204 | 205 | 206 | 207 | IBProjectSource 208 | ./Classes/CartoonViewController.h 209 | 210 | 211 | 212 | RootViewController 213 | BKViewController 214 | 215 | _cartoonController 216 | CartoonViewController 217 | 218 | 219 | _cartoonController 220 | 221 | _cartoonController 222 | CartoonViewController 223 | 224 | 225 | 226 | IBProjectSource 227 | ./Classes/RootViewController.h 228 | 229 | 230 | 231 | 232 | 0 233 | IBCocoaTouchFramework 234 | 235 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 236 | 237 | 238 | 239 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 240 | 241 | 242 | YES 243 | 3 244 | 301 245 | 246 | 247 | -------------------------------------------------------------------------------- /BKTransitionDemo/BKTransitionDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BKTransitionDemo 4 | // 5 | // Created by Brian King on 4/14/11. 6 | // Copyright 2011 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /BKTransitionDemo/Images/Face1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KingOfBrian/BKTransition/b4434ce9e5420fd208a98a46577056ce7eac2122/BKTransitionDemo/Images/Face1.png -------------------------------------------------------------------------------- /BKTransitionDemo/Images/Face2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KingOfBrian/BKTransition/b4434ce9e5420fd208a98a46577056ce7eac2122/BKTransitionDemo/Images/Face2.png -------------------------------------------------------------------------------- /BKTransitionDemo/Images/Face3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KingOfBrian/BKTransition/b4434ce9e5420fd208a98a46577056ce7eac2122/BKTransitionDemo/Images/Face3.png -------------------------------------------------------------------------------- /Classes/NSObject+Proxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Proxy.h 3 | // 4 | // 5 | // Created by Corey Floyd. 6 | // Borrowed From Steve Degutis and Peter Hosey, with a splash of me 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (SDStuff) 12 | 13 | - (id) nextRunloopProxy; 14 | - (id) proxyWithDelay:(float)time; 15 | - (id) performOnMainThreadProxy; 16 | 17 | @end 18 | 19 | @interface UIView (NextRunloop) 20 | + (void) animateNextRunloopWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL))completion; 21 | @end -------------------------------------------------------------------------------- /Classes/NSObject+Proxy.m: -------------------------------------------------------------------------------- 1 | 2 | #import "NSObject+Proxy.h" 3 | 4 | 5 | /****************************************************************************/ 6 | 7 | 8 | 9 | @interface SDNextRunloopProxy : NSObject { 10 | id target; 11 | NSInvocation *invocation; 12 | } 13 | 14 | @end 15 | 16 | 17 | @implementation SDNextRunloopProxy 18 | 19 | - (id) initWithTarget:(id)newTarget { 20 | if ((self = [super init])) { 21 | target = [newTarget retain]; 22 | } 23 | return self; 24 | } 25 | 26 | - (void) performSelectorAtNextRunloop { 27 | [invocation invokeWithTarget:target]; 28 | [target release]; 29 | [invocation release]; 30 | [self release]; 31 | } 32 | 33 | - (void)forwardInvocation:(NSInvocation *)anInvocation { 34 | invocation = [anInvocation retain]; 35 | [invocation retainArguments]; 36 | [self performSelector:@selector(performSelectorAtNextRunloop) withObject:nil afterDelay:0.0]; 37 | } 38 | 39 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { 40 | return [target methodSignatureForSelector:aSelector]; 41 | } 42 | 43 | @end 44 | 45 | /****************************************************************************/ 46 | 47 | 48 | @interface FJSDelayProxy : NSObject { 49 | id target; 50 | NSInvocation *invocation; 51 | float delay; 52 | } 53 | 54 | @end 55 | 56 | @implementation FJSDelayProxy 57 | 58 | - (id) initWithTarget:(id)newTarget delay:(float)time{ 59 | if ((self = [super init])) { 60 | target = [newTarget retain]; 61 | delay = time; 62 | } 63 | return self; 64 | } 65 | 66 | - (void) performSelectorWithDelay { 67 | [invocation invokeWithTarget:target]; 68 | [target release]; 69 | [invocation release]; 70 | [self release]; 71 | } 72 | 73 | - (void)forwardInvocation:(NSInvocation *)anInvocation { 74 | invocation = [anInvocation retain]; 75 | [invocation retainArguments]; 76 | [self performSelector:@selector(performSelectorWithDelay) withObject:nil afterDelay:delay]; 77 | } 78 | 79 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { 80 | return [target methodSignatureForSelector:aSelector]; 81 | } 82 | 83 | @end 84 | 85 | /****************************************************************************/ 86 | 87 | @interface PRHMainThreadPerformingProxy : NSProxy 88 | { 89 | id realObject; 90 | } 91 | 92 | - (id) initWithRealObject:(id)newRealObject; 93 | 94 | @end 95 | 96 | @implementation PRHMainThreadPerformingProxy 97 | 98 | - (id) initWithRealObject:(id)newRealObject { 99 | //This is a direct subclass of NSProxy, so no super message! 100 | realObject = [newRealObject retain]; 101 | return self; 102 | } 103 | - (void) dealloc { 104 | [realObject release]; 105 | [super dealloc]; 106 | } 107 | - (void) finalize { 108 | realObject = nil; 109 | [super finalize]; 110 | } 111 | 112 | - (void) forwardInvocation:(NSInvocation *)invocation { 113 | if (realObject) { 114 | [invocation setTarget:realObject]; 115 | if (![invocation argumentsRetained]) 116 | [invocation retainArguments]; 117 | [invocation performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO]; 118 | } 119 | } 120 | 121 | - (NSMethodSignature *) methodSignatureForSelector:(SEL)selector { 122 | return [realObject methodSignatureForSelector:selector]; 123 | } 124 | 125 | @end 126 | 127 | 128 | /****************************************************************************/ 129 | 130 | 131 | @implementation NSObject (SDStuff) 132 | - (id) nextRunloopProxy { 133 | return [[SDNextRunloopProxy alloc] initWithTarget:self]; 134 | } 135 | 136 | - (id) proxyWithDelay:(float)time{ 137 | 138 | return [[FJSDelayProxy alloc] initWithTarget:self delay:time]; 139 | } 140 | 141 | - (id) performOnMainThreadProxy { 142 | return [[[PRHMainThreadPerformingProxy alloc] initWithRealObject:self] autorelease]; 143 | } 144 | @end 145 | 146 | @implementation UIView(NextRunloop) 147 | 148 | + (void) animateNextRunloopWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL))completion { 149 | [[UIView nextRunloopProxy] animateWithDuration:duration 150 | animations:[[animations copy] autorelease] 151 | completion:[[completion copy] autorelease]]; 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /Classes/UINavigationController+CustomAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+CustomAnimation.h 3 | // lifelapse 4 | // 5 | // Created by Brian King on 12/29/10. 6 | // Copyright 2010 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIView+Transition.h" 11 | 12 | // Informal protocol to define the signals used by custom transitions. 13 | @protocol BKCustomAnimationUINavigationController 14 | @optional 15 | 16 | - (void) animateTransitionEnterFrom:(UIViewController*)fromViewController; 17 | - (void) animateTransitionExitTo:(UIViewController*)toViewController; 18 | 19 | @end 20 | 21 | 22 | @interface UINavigationController(CustomAnimation) 23 | 24 | // Wrapper around UIView's custom animations. UIViewAnimationTransitionCurl/Flip 25 | - (void) pushViewController:(UIViewController *)viewController animation:(UIViewAnimationOptions)options; 26 | - (void) popViewControllerAnimation:(UIViewAnimationOptions)options; 27 | 28 | // Helpers for sliding left, right, up, and down. 29 | - (void) pushViewController:(UIViewController *)viewController slide:(BKSlideDirection)direction; 30 | - (void) popViewControllerSlide:(BKSlideDirection)direction; 31 | - (void) setViewControllers:(NSArray *)viewControllers slide:(BKSlideDirection)direction; 32 | 33 | // Custom Transitions 34 | - (void) pushViewControllerCustomAnimation:(UIViewController *)viewController; 35 | - (void) popViewControllerCustomAnimation; 36 | 37 | // This function is called by the completion block in the custom transition animation 38 | - (void) animationComplete; 39 | 40 | @end 41 | 42 | // When playing with Animations, I found it very painful to move around where my UIViewControllers are 43 | // Defined. Define them by name and get them from anywhere. The views will unload, but the controllers 44 | // are never deallocated. Thanks to FJSTransitionController for the basic code. 45 | 46 | @interface UINavigationController(LazyLoading) 47 | 48 | - (void)setViewControllerWithClass:(Class)viewControllerClass nib:(NSString*)aNibName bundle:(NSString*)bundle forKey:(NSString*)key; 49 | - (void)setViewController:(UIViewController*)controller forKey:(NSString*)key; 50 | - (UIViewController*)viewControllerForKey:(NSString*)key; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Classes/UINavigationController+CustomAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+CustomAnimation.m 3 | // lifelapse 4 | // 5 | // Created by Brian King on 12/29/10. 6 | // Copyright 2010 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "UINavigationController+CustomAnimation.h" 10 | #import "UIView+Transition.h" 11 | 12 | #import "NSObject+Proxy.h" 13 | #include 14 | #import 15 | 16 | // Dictionary Keys for Lazy Loading 17 | static NSString* kClassNameKey = @"kClassNameKey"; 18 | static NSString* kNibNameKey = @"kNibNameKey"; 19 | static NSString* kBundleNameKey = @"kBundleNameKey"; 20 | 21 | static NSString *UINavigationControllerCustomAnimationKey = @"UINavigationControllerCustomAnimation_Key"; 22 | static NSString *UINavigationControllerCustomAnimationNewControllersKey = @"UINavigationControllerCustomAnimationNewControllers_Key"; 23 | static NSString *UINavigationControllerLazyLoadingControllers = @"UINavigationControllerLazyLoadingControllers_Key"; 24 | static NSString *UINavigationControllerLazyLoadingControllerMetaData = @"UINavigationControllerLazyLoadingControllerMetaData_Key"; 25 | 26 | 27 | // These are some new properties to hold some state while the animation is in transition 28 | @interface UINavigationController(CustomAnimationPrivate) 29 | @property (nonatomic, retain) UIViewController *newViewController; 30 | @property (nonatomic, retain) NSArray *newViewControllers; 31 | 32 | @end 33 | 34 | @implementation UINavigationController(CustomAnimation) 35 | - (void) setViewControllers:(NSArray *)viewControllers slide:(BKSlideDirection)direction { 36 | NSParameterAssert(viewControllers); 37 | 38 | UIViewController *viewController = [viewControllers lastObject]; 39 | 40 | // Add the view controller to the superview of the topviewcontroller. 41 | [[self.topViewController.view superview] addSubview:viewController.view]; 42 | 43 | BKSlideDirection otherDirection = BKSlideOtherDirection(direction); 44 | 45 | // Find the offscreen point in the other direction for the view controller to slide on. 46 | CGPoint offscreenPoint = BKSlideOffscreenCenterPoint([[UIScreen mainScreen] bounds], 47 | viewController.view.frame, 48 | otherDirection); 49 | 50 | CGPoint topOffscreenPoint = BKSlideOffscreenCenterPoint([[UIScreen mainScreen] bounds], 51 | viewController.view.frame, 52 | direction); 53 | 54 | // Move to the new place, off screen 55 | [viewController.view transitionMoveTo:offscreenPoint]; 56 | 57 | 58 | [UIView transitionWithView:self.view duration:.4 options:0 animations:^(void) { 59 | self.toolbar.items = viewController.toolbarItems; 60 | [viewController.view removeTransition]; 61 | [self.topViewController.view transitionMoveTo:topOffscreenPoint]; 62 | } completion:^(BOOL completed) { 63 | UIViewController *old = self.topViewController; 64 | self.viewControllers = viewControllers; 65 | [old.view removeTransition]; 66 | }]; 67 | } 68 | 69 | - (void) pushViewController:(UIViewController *)viewController slide:(BKSlideDirection)direction { 70 | // This method is doubled up. If you pass nil, it will pop. A bit ugly, but hey. 71 | BOOL push = YES; 72 | if (viewController == nil) { 73 | push = NO; 74 | NSUInteger count = [self.viewControllers count]; 75 | NSAssert(count > 1, @"Cannot pop top view controller"); 76 | viewController = [self.viewControllers objectAtIndex:count - 2]; 77 | } 78 | 79 | [[self.topViewController.view superview] addSubview:viewController.view]; 80 | 81 | BKSlideDirection otherDirection = BKSlideOtherDirection(direction); 82 | 83 | // Find the offscreen point in the other direction for the view controller to slide on. 84 | CGPoint offscreenPoint = BKSlideOffscreenCenterPoint([[UIScreen mainScreen] bounds], 85 | viewController.view.frame, 86 | otherDirection); 87 | 88 | CGPoint topOffscreenPoint = BKSlideOffscreenCenterPoint([[UIScreen mainScreen] bounds], 89 | viewController.view.frame, 90 | direction); 91 | 92 | // Move to the new place, off screen 93 | [viewController.view transitionMoveTo:offscreenPoint]; 94 | 95 | 96 | [UIView transitionWithView:self.view duration:.4 options:0 animations:^(void) { 97 | self.toolbar.items = viewController.toolbarItems; 98 | [viewController.view removeTransition]; 99 | [self.topViewController.view transitionMoveTo:topOffscreenPoint]; 100 | } completion:^(BOOL completed) { 101 | UIViewController *old = self.topViewController; 102 | if (push) { 103 | [self pushViewController:viewController animated:NO]; 104 | } else { 105 | [self popViewControllerAnimated:NO]; 106 | } 107 | [old.view removeTransition]; 108 | [old.view removeFromSuperview]; 109 | }]; 110 | } 111 | 112 | - (void) popViewControllerSlide:(BKSlideDirection)direction { 113 | [self pushViewController:nil slide:direction]; 114 | } 115 | 116 | - (void) pushViewController:(UIViewController *)viewController animation:(UIViewAnimationOptions)options { 117 | NSAssert(self.visibleViewController != viewController, @"Can not push the visible controller on"); 118 | 119 | [UIView transitionWithView:self.view duration:.4 120 | options:options 121 | animations:^(void) { 122 | [self pushViewController:viewController animated:NO]; 123 | } 124 | completion:nil]; 125 | } 126 | 127 | - (void) popViewControllerAnimation:(UIViewAnimationOptions)options { 128 | [UIView transitionWithView:self.view duration:.4 129 | options:options 130 | animations:^(void) { 131 | [self popViewControllerAnimated:NO]; 132 | } 133 | completion:nil]; 134 | } 135 | 136 | - (void) prepareView:(UIView*)newViewControllerView { 137 | // There's an odd low memory crash here if [newViewController.view superview] is nil, so add it to a stranded 138 | // UIView. 139 | UIView *superContainer = [[UIView alloc] initWithFrame:CGRectZero]; 140 | [superContainer addSubview:newViewControllerView]; 141 | } 142 | - (void) cleanupView:(UIView*)newViewControllerView { 143 | UIView *superContainer = [newViewControllerView superview]; 144 | 145 | if ([superContainer superview] == nil) { 146 | [superContainer autorelease]; 147 | } 148 | } 149 | - (void) popViewControllerCustomAnimation { 150 | NSParameterAssert([self.viewControllers count] > 1); 151 | self.newViewControllers = [self.viewControllers subarrayWithRange:NSMakeRange(0, [self.viewControllers count] - 1)]; 152 | self.newViewController = [self.newViewControllers lastObject]; 153 | 154 | [self prepareView:self.newViewController.view]; 155 | 156 | // Animate the Exit To Transition 157 | UIViewController *currentController = self.topViewController; 158 | 159 | if ([currentController respondsToSelector:@selector(animateTransitionExitTo:)]) { 160 | [currentController performSelector:@selector(animateTransitionExitTo:) withObject:self.newViewController]; 161 | } else { 162 | [self animationComplete]; 163 | } 164 | } 165 | 166 | - (void) pushViewControllerCustomAnimation:(UIViewController*)newController { 167 | self.newViewController = newController; 168 | self.newViewControllers = [self.viewControllers arrayByAddingObject:self.newViewController]; 169 | 170 | [self prepareView:self.newViewController.view]; 171 | 172 | // Animate the Exit To Transition 173 | UIViewController *currentController = self.topViewController; 174 | 175 | if ([currentController respondsToSelector:@selector(animateTransitionExitTo:)]) { 176 | [[currentController nextRunloopProxy] performSelector:@selector(animateTransitionExitTo:) withObject:self.newViewController]; 177 | } else { 178 | [self animationComplete]; 179 | } 180 | } 181 | 182 | - (void) animationComplete { 183 | 184 | if (self.newViewControllers) { 185 | UIViewController *fromVC = [self.viewControllers lastObject]; 186 | [self cleanupView:self.newViewController.view]; 187 | 188 | // Complete the exit stage and perform the enter stage 189 | self.viewControllers = self.newViewControllers; 190 | self.newViewController.view.hidden = NO; 191 | self.newViewControllers = nil; 192 | 193 | [self.view layoutIfNeeded]; 194 | if ([self.newViewController respondsToSelector:@selector(animateTransitionEnterFrom:)]) { 195 | [self.newViewController performSelector:@selector(animateTransitionEnterFrom:) withObject:fromVC]; 196 | } else { 197 | [self animationComplete]; 198 | } 199 | } else { 200 | // We don't have to do anything when enterFrom is finished. 201 | } 202 | } 203 | 204 | - (void) setNewViewController:(UIViewController *)newController { 205 | objc_setAssociatedObject(self, UINavigationControllerCustomAnimationKey, newController, OBJC_ASSOCIATION_RETAIN); 206 | } 207 | 208 | - (UIViewController*) newViewController { 209 | UIViewController* newController = objc_getAssociatedObject(self, UINavigationControllerCustomAnimationKey); 210 | return newController; 211 | } 212 | - (void) setNewViewControllers:(NSArray *)newControllers { 213 | objc_setAssociatedObject(self, UINavigationControllerCustomAnimationNewControllersKey, newControllers, OBJC_ASSOCIATION_RETAIN); 214 | } 215 | 216 | - (NSArray*) newViewControllers { 217 | NSArray *newControllers = objc_getAssociatedObject(self, UINavigationControllerCustomAnimationNewControllersKey); 218 | return newControllers; 219 | } 220 | 221 | @end 222 | 223 | @interface UINavigationController(LazyLoadingPrivate) 224 | @property (nonatomic, retain, readonly) NSMutableDictionary *controllers; 225 | @property (nonatomic, retain, readonly) NSMutableDictionary *controllerMetaData; 226 | @end 227 | @implementation UINavigationController(LazyLoadingPrivate) 228 | 229 | - (NSMutableDictionary*)controllers { 230 | NSMutableDictionary *controllers = objc_getAssociatedObject(self, UINavigationControllerLazyLoadingControllers); 231 | if (controllers == nil) { 232 | controllers = [NSMutableDictionary dictionary]; 233 | objc_setAssociatedObject(self, UINavigationControllerLazyLoadingControllers, controllers, OBJC_ASSOCIATION_RETAIN); 234 | } 235 | return controllers; 236 | } 237 | - (NSMutableDictionary*)controllerMetaData { 238 | NSMutableDictionary *controllerMetaData = objc_getAssociatedObject(self, UINavigationControllerLazyLoadingControllerMetaData); 239 | if (controllerMetaData == nil) { 240 | controllerMetaData = [NSMutableDictionary dictionary]; 241 | objc_setAssociatedObject(self, UINavigationControllerLazyLoadingControllerMetaData, controllerMetaData, OBJC_ASSOCIATION_RETAIN); 242 | } 243 | 244 | return controllerMetaData; 245 | } 246 | 247 | @end 248 | 249 | @implementation UINavigationController(LazyLoading) 250 | #pragma mark - 251 | #pragma mark metaData 252 | 253 | - (UIViewController*)controllerWithMetaData:(NSDictionary*)metaData{ 254 | 255 | UIViewController* controller = nil; 256 | 257 | NSString* className = [metaData objectForKey:kClassNameKey]; 258 | 259 | if(className == nil) 260 | return nil; 261 | 262 | Class vcClass = NSClassFromString(className); 263 | 264 | 265 | NSString* nib = [metaData objectForKey:kNibNameKey]; 266 | NSBundle* bundle = [metaData objectForKey:kBundleNameKey]; 267 | controller = [[vcClass alloc] initWithNibName:nib bundle:bundle]; 268 | 269 | return [controller autorelease]; 270 | } 271 | 272 | 273 | - (NSDictionary*)metaDataForClass:(Class)class nib:(NSString*)aNibName bundle:(NSString*)bundle{ 274 | 275 | NSMutableDictionary* metaData = [NSMutableDictionary dictionaryWithCapacity:3]; 276 | 277 | NSString *className = NSStringFromClass(class); 278 | 279 | if(className == nil) 280 | return nil; 281 | 282 | [metaData setObject:(NSString*)className forKey:kClassNameKey]; 283 | 284 | if(aNibName != nil) 285 | [metaData setObject:aNibName forKey:kNibNameKey]; 286 | 287 | if(bundle != nil) 288 | [metaData setObject:bundle forKey:kBundleNameKey]; 289 | 290 | return metaData; 291 | 292 | } 293 | 294 | 295 | - (void)setViewControllerWithClass:(Class)viewControllerClass nib:(NSString*)aNibName bundle:(NSString*)bundle forKey:(NSString*)key { 296 | [self.controllers removeObjectForKey:key]; 297 | [self.controllerMetaData setObject:[self metaDataForClass:viewControllerClass nib:aNibName bundle:bundle] forKey:key]; 298 | } 299 | - (void)setViewController:(UIViewController*)controller forKey:(NSString*)key { 300 | [self.controllers setObject:controller forKey:key]; 301 | [self.controllerMetaData removeObjectForKey:key]; 302 | } 303 | - (UIViewController*)viewControllerForKey:(NSString*)key { 304 | UIViewController *controller = [self.controllers objectForKey:key]; 305 | if (controller == nil) { 306 | controller = [self controllerWithMetaData:[self.controllerMetaData objectForKey:key]]; 307 | [self.controllers setObject:controller forKey:key]; 308 | } 309 | return controller; 310 | } 311 | 312 | @end 313 | 314 | 315 | #ifdef NAVIGATIONBAR_BACKGROUND 316 | @implementation UINavigationBar(BKCustomDrawing) 317 | 318 | #pragma mark Custom Drawing 319 | - (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)context 320 | { 321 | if ([self isMemberOfClass:[UINavigationBar class]] == NO) { 322 | return; 323 | } 324 | UIImage *image = [UIImage imageNamed:NAVIGATIONBAR_BACKGROUND]; 325 | // CGContextClip(context); 326 | CGContextTranslateCTM(context, 0, image.size.height); 327 | CGContextScaleCTM(context, 1.0, -1.0); 328 | CGContextDrawImage(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), image.CGImage); 329 | } 330 | 331 | 332 | 333 | @end 334 | #endif -------------------------------------------------------------------------------- /Classes/UIView+Transition.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Home.h 3 | // lifelapse 4 | // 5 | // Created by Brian King on 12/29/10. 6 | // Copyright 2010 King Software Design. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "NSObject+Proxy.h" 12 | 13 | #define BK_EXTERN extern __attribute__((visibility ("default"))) 14 | 15 | typedef enum { 16 | BKSlideDirectionRight = 1 << 0, 17 | BKSlideDirectionLeft = 1 << 1, 18 | BKSlideDirectionUp = 1 << 2, 19 | BKSlideDirectionDown = 1 << 3, 20 | 21 | BKSlideDirectionVertical = BKSlideDirectionUp | BKSlideDirectionDown, 22 | BKSlideDirectionHorizontal = BKSlideDirectionLeft | BKSlideDirectionRight 23 | } BKSlideDirection; 24 | 25 | BK_EXTERN BKSlideDirection BKSlideOrientation(BKSlideDirection direction); 26 | BK_EXTERN BKSlideDirection BKSlideOtherDirection(BKSlideDirection direction); 27 | BK_EXTERN BOOL BKSlideIsDirection(BKSlideDirection check, BKSlideDirection direction); 28 | BK_EXTERN CGPoint BKSlideOffscreenCenterPoint(CGRect enclosingFrame, CGRect frame, BKSlideDirection direction); 29 | BK_EXTERN CGPoint CGPointCenterOfRect(CGRect frame); 30 | 31 | @interface UIView(Transition) 32 | 33 | - (void) transitionMoveDirection:(BKSlideDirection)direction by:(CGFloat)pixels; 34 | - (void) transitionMoveOffscreenDirection:(BKSlideDirection)direction; 35 | - (void) transitionMoveBy:(CGPoint)offset; 36 | - (void) transitionMoveTo:(CGPoint)newPoint; 37 | - (void) transitionSizeTo:(CGSize)size; 38 | - (void) transitionSizeTo:(CGSize)toSize from:(CGSize)fromSize; 39 | - (void) transitionTo:(CGRect)newLocation; 40 | - (void) removeTransition; 41 | 42 | @property (assign, nonatomic) CGAffineTransform transitionTransform; 43 | 44 | @end 45 | 46 | -------------------------------------------------------------------------------- /Classes/UIView+Transition.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Home.m 3 | // lifelapse 4 | // 5 | // Created by Brian King on 12/29/10. 6 | // Copyright 2010 King Software Design. All rights reserved. 7 | // 8 | 9 | #import "UIView+Transition.h" 10 | #include 11 | 12 | BK_EXTERN BOOL BKSlideIsDirection(BKSlideDirection check, BKSlideDirection direction) { 13 | BOOL value = (check | direction) == check; 14 | return value; 15 | } 16 | 17 | BK_EXTERN BKSlideDirection BKSlideOrientation(BKSlideDirection direction) { 18 | if ((direction | BKSlideDirectionHorizontal) == BKSlideDirectionHorizontal) { 19 | return BKSlideDirectionHorizontal; 20 | } else { 21 | return BKSlideDirectionVertical; 22 | } 23 | } 24 | 25 | BK_EXTERN BKSlideDirection BKSlideOtherDirection(BKSlideDirection direction) { 26 | BKSlideDirection orientation = BKSlideOrientation(direction); 27 | return (direction ^ orientation); 28 | } 29 | 30 | BK_EXTERN CGPoint CGPointCenterOfRect(CGRect frame) { 31 | return CGPointMake(frame.origin.x + (frame.size.width / 2), 32 | frame.origin.y + (frame.size.height / 2)); 33 | } 34 | 35 | BK_EXTERN CGPoint BKSlideOffscreenCenterPoint(CGRect enclosingFrame, CGRect frame, BKSlideDirection direction) { 36 | 37 | // In theory this might handle diagonals too, but the mask would need to be altered. 38 | CGPoint offscreenCenter = CGPointCenterOfRect(frame); 39 | if (BKSlideIsDirection(BKSlideDirectionVertical, direction)) { 40 | CGFloat shift = frame.size.height / 2; 41 | 42 | if (BKSlideIsDirection(BKSlideDirectionUp, direction)) { 43 | offscreenCenter.y = enclosingFrame.origin.y - shift; 44 | } else if (BKSlideIsDirection(BKSlideDirectionDown, direction)) { 45 | offscreenCenter.y = enclosingFrame.size.height + shift; 46 | } 47 | } 48 | if (BKSlideIsDirection(BKSlideDirectionHorizontal, direction)) { 49 | CGFloat shift = frame.size.width / 2; 50 | 51 | if (BKSlideIsDirection(BKSlideDirectionRight, direction)) { 52 | offscreenCenter.x = enclosingFrame.size.width + shift; 53 | } else if (BKSlideIsDirection(BKSlideDirectionLeft, direction)) { 54 | offscreenCenter.x = enclosingFrame.origin.x - shift; 55 | } 56 | } 57 | return offscreenCenter; 58 | } 59 | 60 | static NSString *UIViewTransitionKey = @"UIView_Transition_Key"; 61 | 62 | @implementation UIView(Transition) 63 | 64 | - (void) setTransitionTransform:(CGAffineTransform)tt { 65 | objc_setAssociatedObject(self, UIViewTransitionKey, [NSValue valueWithCGAffineTransform:tt], OBJC_ASSOCIATION_RETAIN); 66 | 67 | } 68 | 69 | 70 | - (CGAffineTransform) transitionTransform { 71 | NSValue *transformAsValue = objc_getAssociatedObject(self, UIViewTransitionKey); 72 | if (transformAsValue) { 73 | return [transformAsValue CGAffineTransformValue]; 74 | } 75 | return CGAffineTransformIdentity; 76 | } 77 | 78 | - (void) transitionMoveDirection:(BKSlideDirection)direction by:(CGFloat)pixels { 79 | CGPoint move = CGPointMake(0, 0); 80 | if (direction == UISwipeGestureRecognizerDirectionRight) { 81 | move.x += pixels; 82 | } else if (direction == UISwipeGestureRecognizerDirectionLeft) { 83 | move.x -= pixels; 84 | } else if (direction == UISwipeGestureRecognizerDirectionUp) { 85 | move.y -= pixels; 86 | } else if (direction == UISwipeGestureRecognizerDirectionDown) { 87 | move.y += pixels; 88 | } 89 | [self transitionMoveBy:move]; 90 | 91 | } 92 | 93 | - (void) transitionMoveOffscreenDirection:(BKSlideDirection)direction { 94 | CGPoint offscreenCenter = BKSlideOffscreenCenterPoint([UIScreen mainScreen].bounds, 95 | self.frame, 96 | direction); 97 | [self transitionMoveTo:offscreenCenter]; 98 | } 99 | - (void) transitionMoveTo:(CGPoint)newCenter { 100 | CGPoint offset = CGPointMake(newCenter.x - self.center.x, 101 | newCenter.y - self.center.y); 102 | 103 | CGAffineTransform move = CGAffineTransformMakeTranslation(offset.x, offset.y); 104 | self.transitionTransform = CGAffineTransformConcat(self.transitionTransform, move); 105 | 106 | self.transform = CGAffineTransformConcat(self.transform, move); 107 | } 108 | 109 | - (void) transitionMoveBy:(CGPoint)offset { 110 | // Create the move transform 111 | CGAffineTransform move = CGAffineTransformMakeTranslation(offset.x, offset.y); 112 | 113 | // Apply the move transform to the transitionTransform varible so it can be un-done 114 | self.transitionTransform = CGAffineTransformConcat(self.transitionTransform, move); 115 | 116 | // Apply the move transform to the transform variable so it occurs 117 | self.transform = CGAffineTransformConcat(self.transform, move); 118 | } 119 | - (void) transitionSizeTo:(CGSize)toSize { 120 | [self transitionSizeTo:toSize from:self.frame.size]; 121 | } 122 | 123 | - (void) transitionSizeTo:(CGSize)toSize from:(CGSize)fromSize { 124 | CGFloat sx = fromSize.width / toSize.width; 125 | CGFloat sy = fromSize.height / toSize.height; 126 | CGAffineTransform scale = CGAffineTransformMakeScale(1/sx, 1/sy); 127 | 128 | // Apply the move transform to the transitionTransform varible so it can be un-done 129 | self.transitionTransform = CGAffineTransformConcat(self.transitionTransform, scale); 130 | 131 | // Apply the move transform to the transform variable so it occurs 132 | self.transform = CGAffineTransformConcat(self.transform, scale); 133 | } 134 | 135 | - (void) transitionTo:(CGRect)newLocation { 136 | // Create the scale 137 | CGSize toSize = newLocation.size; 138 | CGSize fromSize = self.frame.size; 139 | CGFloat sx = toSize.width / fromSize.width; 140 | CGFloat sy = toSize.height / fromSize.height; 141 | CGAffineTransform scale = CGAffineTransformMakeScale(sx, sy); 142 | // Create the move 143 | CGPoint newCenter = CGPointCenterOfRect(newLocation); 144 | 145 | CGPoint offset = CGPointMake(newCenter.x - self.center.x, 146 | newCenter.y - self.center.y); 147 | 148 | CGAffineTransform move = CGAffineTransformMakeTranslation(offset.x, offset.y); 149 | self.transitionTransform = CGAffineTransformConcat(self.transitionTransform, CGAffineTransformConcat(scale, move)); 150 | self.transform = CGAffineTransformConcat(self.transform, CGAffineTransformConcat(scale, move)); 151 | } 152 | 153 | - (void) removeTransition { 154 | if (!CGAffineTransformIsIdentity(self.transitionTransform)) { 155 | self.transform = CGAffineTransformConcat(self.transform, CGAffineTransformInvert(self.transitionTransform)); 156 | self.transitionTransform = CGAffineTransformIdentity; 157 | } 158 | } 159 | @end 160 | --------------------------------------------------------------------------------