├── Bad.gif ├── Basic Example ├── Basic Example.xcodeproj │ └── project.pbxproj └── Basic Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Basic Example-Info.plist │ ├── Basic Example-Prefix.pch │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── HidesNavigationBarViewController.h │ ├── HidesNavigationBarViewController.m │ ├── Steve.png │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── Good.gif ├── LICENSE ├── README.markdown ├── TRVSNavigationControllerTransition.podspec ├── UINavigationController+TRVSNavigationControllerTransition.h └── UINavigationController+TRVSNavigationControllerTransition.m /Bad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Bad.gif -------------------------------------------------------------------------------- /Basic Example/Basic Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3262C5E51635147D00D590CF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3262C5E41635147D00D590CF /* UIKit.framework */; }; 11 | 3262C5E71635147D00D590CF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3262C5E61635147D00D590CF /* Foundation.framework */; }; 12 | 3262C5E91635147D00D590CF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3262C5E81635147D00D590CF /* CoreGraphics.framework */; }; 13 | 3262C5EF1635147D00D590CF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3262C5ED1635147D00D590CF /* InfoPlist.strings */; }; 14 | 3262C5F11635147D00D590CF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3262C5F01635147D00D590CF /* main.m */; }; 15 | 3262C5F51635147D00D590CF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3262C5F41635147D00D590CF /* AppDelegate.m */; }; 16 | 3262C5F71635147D00D590CF /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 3262C5F61635147D00D590CF /* Default.png */; }; 17 | 3262C5F91635147D00D590CF /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3262C5F81635147D00D590CF /* Default@2x.png */; }; 18 | 3262C5FB1635147D00D590CF /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3262C5FA1635147D00D590CF /* Default-568h@2x.png */; }; 19 | 3262C6031635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 3262C6021635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.m */; }; 20 | 3262C606163514B600D590CF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3262C605163514B600D590CF /* ViewController.m */; }; 21 | 3262C608163515F300D590CF /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3262C607163515F300D590CF /* QuartzCore.framework */; }; 22 | 3262C60B16351A2F00D590CF /* HidesNavigationBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3262C60A16351A2F00D590CF /* HidesNavigationBarViewController.m */; }; 23 | 3262C60D16351C8300D590CF /* Steve.png in Resources */ = {isa = PBXBuildFile; fileRef = 3262C60C16351C8300D590CF /* Steve.png */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 3262C5E01635147D00D590CF /* Basic Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Basic Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 3262C5E41635147D00D590CF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 29 | 3262C5E61635147D00D590CF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 30 | 3262C5E81635147D00D590CF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 31 | 3262C5EC1635147D00D590CF /* Basic Example-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Basic Example-Info.plist"; sourceTree = ""; }; 32 | 3262C5EE1635147D00D590CF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 33 | 3262C5F01635147D00D590CF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 3262C5F21635147D00D590CF /* Basic Example-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Basic Example-Prefix.pch"; sourceTree = ""; }; 35 | 3262C5F31635147D00D590CF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | 3262C5F41635147D00D590CF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | 3262C5F61635147D00D590CF /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 38 | 3262C5F81635147D00D590CF /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 39 | 3262C5FA1635147D00D590CF /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 40 | 3262C6011635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UINavigationController+TRVSNavigationControllerTransition.h"; path = "../../UINavigationController+TRVSNavigationControllerTransition.h"; sourceTree = ""; }; 41 | 3262C6021635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UINavigationController+TRVSNavigationControllerTransition.m"; path = "../../UINavigationController+TRVSNavigationControllerTransition.m"; sourceTree = ""; }; 42 | 3262C604163514B600D590CF /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 43 | 3262C605163514B600D590CF /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 44 | 3262C607163515F300D590CF /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 45 | 3262C60916351A2F00D590CF /* HidesNavigationBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HidesNavigationBarViewController.h; sourceTree = ""; }; 46 | 3262C60A16351A2F00D590CF /* HidesNavigationBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HidesNavigationBarViewController.m; sourceTree = ""; }; 47 | 3262C60C16351C8300D590CF /* Steve.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Steve.png; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 3262C5DD1635147D00D590CF /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | 3262C608163515F300D590CF /* QuartzCore.framework in Frameworks */, 56 | 3262C5E51635147D00D590CF /* UIKit.framework in Frameworks */, 57 | 3262C5E71635147D00D590CF /* Foundation.framework in Frameworks */, 58 | 3262C5E91635147D00D590CF /* CoreGraphics.framework in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 3262C5D51635147D00D590CF = { 66 | isa = PBXGroup; 67 | children = ( 68 | 3262C607163515F300D590CF /* QuartzCore.framework */, 69 | 3262C5EA1635147D00D590CF /* Basic Example */, 70 | 3262C5E31635147D00D590CF /* Frameworks */, 71 | 3262C5E11635147D00D590CF /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 3262C5E11635147D00D590CF /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 3262C5E01635147D00D590CF /* Basic Example.app */, 79 | ); 80 | name = Products; 81 | sourceTree = ""; 82 | }; 83 | 3262C5E31635147D00D590CF /* Frameworks */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3262C5E41635147D00D590CF /* UIKit.framework */, 87 | 3262C5E61635147D00D590CF /* Foundation.framework */, 88 | 3262C5E81635147D00D590CF /* CoreGraphics.framework */, 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | 3262C5EA1635147D00D590CF /* Basic Example */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 3262C6011635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.h */, 97 | 3262C6021635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.m */, 98 | 3262C5F31635147D00D590CF /* AppDelegate.h */, 99 | 3262C5F41635147D00D590CF /* AppDelegate.m */, 100 | 3262C604163514B600D590CF /* ViewController.h */, 101 | 3262C605163514B600D590CF /* ViewController.m */, 102 | 3262C60916351A2F00D590CF /* HidesNavigationBarViewController.h */, 103 | 3262C60A16351A2F00D590CF /* HidesNavigationBarViewController.m */, 104 | 3262C5EB1635147D00D590CF /* Supporting Files */, 105 | ); 106 | path = "Basic Example"; 107 | sourceTree = ""; 108 | }; 109 | 3262C5EB1635147D00D590CF /* Supporting Files */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 3262C5EC1635147D00D590CF /* Basic Example-Info.plist */, 113 | 3262C5ED1635147D00D590CF /* InfoPlist.strings */, 114 | 3262C5F01635147D00D590CF /* main.m */, 115 | 3262C5F21635147D00D590CF /* Basic Example-Prefix.pch */, 116 | 3262C5F61635147D00D590CF /* Default.png */, 117 | 3262C5F81635147D00D590CF /* Default@2x.png */, 118 | 3262C5FA1635147D00D590CF /* Default-568h@2x.png */, 119 | 3262C60C16351C8300D590CF /* Steve.png */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | /* End PBXGroup section */ 125 | 126 | /* Begin PBXNativeTarget section */ 127 | 3262C5DF1635147D00D590CF /* Basic Example */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = 3262C5FE1635147D00D590CF /* Build configuration list for PBXNativeTarget "Basic Example" */; 130 | buildPhases = ( 131 | 3262C5DC1635147D00D590CF /* Sources */, 132 | 3262C5DD1635147D00D590CF /* Frameworks */, 133 | 3262C5DE1635147D00D590CF /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = "Basic Example"; 140 | productName = "Basic Example"; 141 | productReference = 3262C5E01635147D00D590CF /* Basic Example.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 3262C5D71635147D00D590CF /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 0450; 151 | ORGANIZATIONNAME = "Daft Co."; 152 | }; 153 | buildConfigurationList = 3262C5DA1635147D00D590CF /* Build configuration list for PBXProject "Basic Example" */; 154 | compatibilityVersion = "Xcode 3.2"; 155 | developmentRegion = English; 156 | hasScannedForEncodings = 0; 157 | knownRegions = ( 158 | en, 159 | ); 160 | mainGroup = 3262C5D51635147D00D590CF; 161 | productRefGroup = 3262C5E11635147D00D590CF /* Products */; 162 | projectDirPath = ""; 163 | projectRoot = ""; 164 | targets = ( 165 | 3262C5DF1635147D00D590CF /* Basic Example */, 166 | ); 167 | }; 168 | /* End PBXProject section */ 169 | 170 | /* Begin PBXResourcesBuildPhase section */ 171 | 3262C5DE1635147D00D590CF /* Resources */ = { 172 | isa = PBXResourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 3262C5EF1635147D00D590CF /* InfoPlist.strings in Resources */, 176 | 3262C5F71635147D00D590CF /* Default.png in Resources */, 177 | 3262C5F91635147D00D590CF /* Default@2x.png in Resources */, 178 | 3262C5FB1635147D00D590CF /* Default-568h@2x.png in Resources */, 179 | 3262C60D16351C8300D590CF /* Steve.png in Resources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXResourcesBuildPhase section */ 184 | 185 | /* Begin PBXSourcesBuildPhase section */ 186 | 3262C5DC1635147D00D590CF /* Sources */ = { 187 | isa = PBXSourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 3262C5F11635147D00D590CF /* main.m in Sources */, 191 | 3262C5F51635147D00D590CF /* AppDelegate.m in Sources */, 192 | 3262C6031635149400D590CF /* UINavigationController+TRVSNavigationControllerTransition.m in Sources */, 193 | 3262C606163514B600D590CF /* ViewController.m in Sources */, 194 | 3262C60B16351A2F00D590CF /* HidesNavigationBarViewController.m in Sources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXSourcesBuildPhase section */ 199 | 200 | /* Begin PBXVariantGroup section */ 201 | 3262C5ED1635147D00D590CF /* InfoPlist.strings */ = { 202 | isa = PBXVariantGroup; 203 | children = ( 204 | 3262C5EE1635147D00D590CF /* en */, 205 | ); 206 | name = InfoPlist.strings; 207 | sourceTree = ""; 208 | }; 209 | /* End PBXVariantGroup section */ 210 | 211 | /* Begin XCBuildConfiguration section */ 212 | 3262C5FC1635147D00D590CF /* Debug */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 217 | CLANG_CXX_LIBRARY = "libc++"; 218 | CLANG_ENABLE_OBJC_ARC = YES; 219 | CLANG_WARN_EMPTY_BODY = YES; 220 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 221 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 222 | COPY_PHASE_STRIP = NO; 223 | GCC_C_LANGUAGE_STANDARD = gnu99; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 232 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 233 | GCC_WARN_UNUSED_VARIABLE = YES; 234 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 235 | ONLY_ACTIVE_ARCH = YES; 236 | SDKROOT = iphoneos; 237 | }; 238 | name = Debug; 239 | }; 240 | 3262C5FD1635147D00D590CF /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | COPY_PHASE_STRIP = YES; 251 | GCC_C_LANGUAGE_STANDARD = gnu99; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 253 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 256 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 257 | SDKROOT = iphoneos; 258 | VALIDATE_PRODUCT = YES; 259 | }; 260 | name = Release; 261 | }; 262 | 3262C5FF1635147D00D590CF /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 266 | GCC_PREFIX_HEADER = "Basic Example/Basic Example-Prefix.pch"; 267 | INFOPLIST_FILE = "Basic Example/Basic Example-Info.plist"; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | WRAPPER_EXTENSION = app; 270 | }; 271 | name = Debug; 272 | }; 273 | 3262C6001635147D00D590CF /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 277 | GCC_PREFIX_HEADER = "Basic Example/Basic Example-Prefix.pch"; 278 | INFOPLIST_FILE = "Basic Example/Basic Example-Info.plist"; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | WRAPPER_EXTENSION = app; 281 | }; 282 | name = Release; 283 | }; 284 | /* End XCBuildConfiguration section */ 285 | 286 | /* Begin XCConfigurationList section */ 287 | 3262C5DA1635147D00D590CF /* Build configuration list for PBXProject "Basic Example" */ = { 288 | isa = XCConfigurationList; 289 | buildConfigurations = ( 290 | 3262C5FC1635147D00D590CF /* Debug */, 291 | 3262C5FD1635147D00D590CF /* Release */, 292 | ); 293 | defaultConfigurationIsVisible = 0; 294 | defaultConfigurationName = Release; 295 | }; 296 | 3262C5FE1635147D00D590CF /* Build configuration list for PBXNativeTarget "Basic Example" */ = { 297 | isa = XCConfigurationList; 298 | buildConfigurations = ( 299 | 3262C5FF1635147D00D590CF /* Debug */, 300 | 3262C6001635147D00D590CF /* Release */, 301 | ); 302 | defaultConfigurationIsVisible = 0; 303 | }; 304 | /* End XCConfigurationList section */ 305 | }; 306 | rootObject = 3262C5D71635147D00D590CF /* Project object */; 307 | } 308 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | ViewController *viewController = [[ViewController alloc] init]; 18 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 19 | navigationController.navigationBar.translucent = YES; 20 | self.window.rootViewController = navigationController; 21 | self.window.backgroundColor = [UIColor whiteColor]; 22 | [self.window makeKeyAndVisible]; 23 | return YES; 24 | } 25 | 26 | - (void)applicationWillResignActive:(UIApplication *)application 27 | { 28 | // 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. 29 | // 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. 30 | } 31 | 32 | - (void)applicationDidEnterBackground:(UIApplication *)application 33 | { 34 | // 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. 35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 36 | } 37 | 38 | - (void)applicationWillEnterForeground:(UIApplication *)application 39 | { 40 | // 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. 41 | } 42 | 43 | - (void)applicationDidBecomeActive:(UIApplication *)application 44 | { 45 | // 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. 46 | } 47 | 48 | - (void)applicationWillTerminate:(UIApplication *)application 49 | { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/Basic Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.travisjeffery.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/Basic Example-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Basic Example' target in the 'Basic Example' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Basic Example/Basic Example/Default-568h@2x.png -------------------------------------------------------------------------------- /Basic Example/Basic Example/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Basic Example/Basic Example/Default.png -------------------------------------------------------------------------------- /Basic Example/Basic Example/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Basic Example/Basic Example/Default@2x.png -------------------------------------------------------------------------------- /Basic Example/Basic Example/HidesNavigationBarViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HidesNavigationBarViewController.h 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HidesNavigationBarViewController : UIViewController 12 | 13 | @property (nonatomic, strong) UIToolbar *toolBar; 14 | @property (nonatomic, strong) UIImageView *backgroundImageView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/HidesNavigationBarViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HidesNavigationBarViewController.m 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import "UINavigationController+TRVSNavigationControllerTransition.h" 10 | #import "HidesNavigationBarViewController.h" 11 | 12 | @interface HidesNavigationBarViewController () 13 | 14 | @end 15 | 16 | @implementation HidesNavigationBarViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | CGSize boundsSize = self.view.bounds.size; 22 | self.toolBar = [[UIToolbar alloc] initWithFrame:CGRectZero]; 23 | self.toolBar.frame = CGRectMake(0.f, boundsSize.height - 44.f, boundsSize.width, 44.f); 24 | 25 | self.view.backgroundColor = [UIColor whiteColor]; 26 | 27 | UIBarButtonItem *badPushBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Bad Push", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(pushBadAction:)]; 28 | UIBarButtonItem *goodPushBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Good Push", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(pushGoodAction:)]; 29 | UIBarButtonItem *showNavigationBarBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Show Navigation Bar", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(showNavigationBar:)]; 30 | UIBarButtonItem *spaceBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 31 | 32 | self.toolBar.items = @[showNavigationBarBarButtonItem, spaceBarButtonItem, badPushBarButtonItem, spaceBarButtonItem, goodPushBarButtonItem]; 33 | 34 | [self.view addSubview:self.toolBar]; 35 | 36 | self.backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Steve"]]; 37 | self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFit; 38 | self.backgroundImageView.frame = CGRectMake(0.f, 0.f, boundsSize.width, boundsSize.height - CGRectGetHeight(self.toolBar.frame)); 39 | [self.view addSubview:self.backgroundImageView]; 40 | 41 | } 42 | 43 | - (void)viewWillAppear:(BOOL)animated 44 | { 45 | [super viewWillAppear:animated]; 46 | self.navigationController.navigationBar.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, 0.f, -CGRectGetHeight(self.navigationController.navigationBar.frame)); 47 | } 48 | 49 | 50 | - (void)pushBadAction:(id)sender 51 | { 52 | HidesNavigationBarViewController *viewController = [[HidesNavigationBarViewController alloc] init]; 53 | [self.navigationController pushViewController:viewController animated:YES]; 54 | } 55 | 56 | - (void)pushGoodAction:(id)sender 57 | { 58 | HidesNavigationBarViewController *viewController = [[HidesNavigationBarViewController alloc] init]; 59 | [self.navigationController trvs_pushViewControllerWithNavigationControllerTransition:viewController]; 60 | } 61 | 62 | - (void)showNavigationBar:(id)sender 63 | { 64 | self.navigationController.navigationBar.transform = CGAffineTransformIdentity; 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/Steve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Basic Example/Basic Example/Steve.png -------------------------------------------------------------------------------- /Basic Example/Basic Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (nonatomic, strong) UIToolbar *toolBar; 14 | @property (nonatomic, strong) UIImageView *backgroundImageView; 15 | @property (nonatomic, strong) UITextView *textView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "HidesNavigationBarViewController.h" 11 | #import "UINavigationController+TRVSNavigationControllerTransition.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | 23 | self.navigationItem.title = NSLocalizedString(@"Basic Example", nil); 24 | 25 | CGSize boundsSize = self.view.bounds.size; 26 | self.toolBar = [[UIToolbar alloc] initWithFrame:CGRectZero]; 27 | self.toolBar.frame = CGRectMake(0.f, boundsSize.height - 44.f, boundsSize.width, 44.f); 28 | 29 | self.view.backgroundColor = [UIColor blackColor]; 30 | 31 | UIBarButtonItem *badPushBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Bad Push", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(pushBadAction:)]; 32 | UIBarButtonItem *goodPushBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Good Push", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(pushGoodAction:)]; 33 | UIBarButtonItem *showNavigationBarBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Show Navigation Bar", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(showNavigationBar:)]; 34 | UIBarButtonItem *spaceBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 35 | 36 | self.toolBar.items = @[showNavigationBarBarButtonItem, spaceBarButtonItem, badPushBarButtonItem, spaceBarButtonItem, goodPushBarButtonItem]; 37 | 38 | [self.view addSubview:self.toolBar]; 39 | 40 | self.textView = [[UITextView alloc] initWithFrame:CGRectZero]; 41 | self.textView.font = [UIFont fontWithName:@"HelveticaNeue" size:20.f]; 42 | self.textView.textColor = [UIColor colorWithRed:102.f/255.f green:102.f/255.f blue:102.f/255.f alpha:1.f]; 43 | self.textView.editable = NO; 44 | self.textView.scrollEnabled = NO; 45 | self.textView.dataDetectorTypes = UIDataDetectorTypeLink; 46 | self.textView.text = @"Hey! Play around with the buttons below and be sure to keep an eye on how the navigation bar transitions.\n\n- Travis Jeffery on GitHub: github.com/travisjeffery\n- Travis Jeffery on Twitter: twitter.com/travisjeffery\n\nThanks!"; 47 | self.textView.frame = CGRectMake(0.f, 0.f, boundsSize.width, boundsSize.height - (CGRectGetHeight(self.navigationController.navigationBar.frame) + CGRectGetHeight(self.toolBar.frame))); 48 | self.textView.center = CGPointMake(roundf(boundsSize.width/2.f), roundf(boundsSize.height/2.f)); 49 | 50 | [self.view addSubview:self.textView]; 51 | } 52 | 53 | - (void)pushBadAction:(id)sender 54 | { 55 | HidesNavigationBarViewController *viewController = [[HidesNavigationBarViewController alloc] init]; 56 | [self.navigationController pushViewController:viewController animated:YES]; 57 | } 58 | 59 | - (void)pushGoodAction:(id)sender 60 | { 61 | HidesNavigationBarViewController *viewController = [[HidesNavigationBarViewController alloc] init]; 62 | [self.navigationController trvs_pushViewControllerWithNavigationControllerTransition:viewController]; 63 | } 64 | 65 | - (void)showNavigationBar:(id)sender 66 | { 67 | self.navigationController.navigationBar.transform = CGAffineTransformIdentity; 68 | } 69 | 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Basic Example/Basic Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Basic Example 4 | // 5 | // Created by Travis Jeffery on 2012-10-22. 6 | // Copyright (c) 2012 Daft Co. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Good.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/travisjeffery/TRVSNavigationControllerTransition/a3ed5a3d94f823a05679e4ccf244ea5389e0a219/Good.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Travis Jeffery (@travisjeffery/travisjeffery@gmail.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # UINavigationController+TRVSNavigationControllerTransition Category 2 | 3 |
4 | 5 | This category provides two methods on UINavigationControllers to push and pop 6 | view controllers with an animated transition of the entire UINavigationController's view, rather just the view controller's. 7 | 8 | ## Author: Travis Jeffery 9 | 10 | - [@travisjeffery on Twitter](http://twitter.com/travisjeffery) 11 | - [@travisjeffery on GitHub](http://github.com/travisjeffery) 12 | - travisjeffery@gmail.com 13 | 14 | ### API 15 | 16 | ``` objective-c 17 | - (void)pushViewControllerWithNavigationControllerTransition:(UIViewController *)viewController; 18 | - (void)popViewControllerWithNavigationControllerTransition; 19 | ``` 20 | 21 | ### Usages 22 | 23 | One usage of this is when you push a view controller onto your 24 | UINavigationController and that view controller wants to have its navigationBar drawn above its view so that you can translate it in. 25 | 26 | ### Example 27 | 28 | The left photo below is using `pushViewController:animated:`, notice how the navigation bar 29 | in the current view is put out of view by making the navigation bar's origin y point -the navigation bar's height (so you can animate 30 | it in when the user scrolls) before the transition is finished. The right photo is using `pushViewControllerWithNavigationControllerTransition:`, now by 31 | using multiple layers we can keep the navigationBar visible in the current view 32 | until the transition completes. **Keep an eye on the navigation bar.** 33 | 34 | ![Bad](https://raw.github.com/travisjeffery/TRVSNavigationControllerTransition/master/Bad.gif) ![Good](https://raw.github.com/travisjeffery/TRVSNavigationControllerTransition/master/Good.gif) 35 | 36 | MIT License, see the LICENSE file for details. 37 | 38 | -------------------------------------------------------------------------------- /TRVSNavigationControllerTransition.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "TRVSNavigationControllerTransition" 3 | s.version = "0.1.0" 4 | s.summary = "Push/Pop transition for entire UINavigationController views." 5 | s.homepage = "https://github.com/travisjeffery/TRVSNavigationControllerTransition" 6 | 7 | s.license = { :type => 'MIT', :file => 'LICENSE'} 8 | 9 | s.author = { "Travis Jeffery" => "travisjeffery@gmail.com" } 10 | 11 | s.platform = :ios, '5.0' 12 | 13 | s.source = { :git => "https://github.com/travisjeffery/TRVSNavigationControllerTransition.git", :tag => "0.1.0" } 14 | s.source_files = 'UINavigationController+TRVSNavigationControllerTransition*.{h,m}' 15 | 16 | s.framework = 'QuartzCore' 17 | 18 | s.requires_arc = true 19 | end 20 | -------------------------------------------------------------------------------- /UINavigationController+TRVSNavigationControllerTransition.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+TRVSNavigationControllerTranslation.h 3 | // Daft Co. 4 | // 5 | // Created by Travis Jeffery on 2012-10-21. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface UINavigationController (TRVSNavigationControllerTransition) 12 | - (void)trvs_pushViewControllerWithNavigationControllerTransition:(UIViewController *)viewController; 13 | - (void)trvs_popViewControllerWithNavigationControllerTransition; 14 | @end 15 | -------------------------------------------------------------------------------- /UINavigationController+TRVSNavigationControllerTransition.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINavigationController+TRVSNavigationControllerTranslation.m 3 | // Daft Co. 4 | // 5 | // Created by Travis Jeffery on 2012-10-21. 6 | // 7 | // 8 | 9 | #import 10 | #import "UINavigationController+TRVSNavigationControllerTransition.h" 11 | 12 | static CALayer *TRVSStillLayer = nil; 13 | static CALayer *TRVSTransitioningLayer = nil; 14 | static NSTimeInterval const TRVSTransitionDuration = .3f; 15 | 16 | @interface TRVSNavigationControllerTransitionAnimiationDelegate : NSObject 17 | 18 | - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag; 19 | + (TRVSNavigationControllerTransitionAnimiationDelegate *)sharedDelegate; 20 | 21 | @end 22 | 23 | @implementation TRVSNavigationControllerTransitionAnimiationDelegate 24 | 25 | - (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag { 26 | [TRVSStillLayer removeFromSuperlayer]; 27 | [TRVSTransitioningLayer removeFromSuperlayer]; 28 | } 29 | 30 | + (TRVSNavigationControllerTransitionAnimiationDelegate *)sharedDelegate { 31 | static dispatch_once_t onceToken; 32 | __strong static id sharedDelegate = nil; 33 | dispatch_once(&onceToken, ^{ sharedDelegate = [[self alloc] init]; }); 34 | return sharedDelegate; 35 | } 36 | 37 | @end 38 | 39 | @implementation UINavigationController (TRVSNavigationControllerTransition) 40 | 41 | - (void)trvs_pushViewControllerWithNavigationControllerTransition: 42 | (UIViewController *)viewController { 43 | TRVSStillLayer = [self trvs_layerSnapshotWithTransform:CATransform3DIdentity]; 44 | 45 | [self pushViewController:viewController animated:NO]; 46 | 47 | TRVSTransitioningLayer = 48 | [self trvs_layerSnapshotWithTransform:CATransform3DIdentity]; 49 | TRVSTransitioningLayer.frame = (CGRect) { 50 | {CGRectGetWidth(self.view.bounds), CGRectGetMinY(self.view.bounds)}, 51 | self.view.bounds.size}; 52 | 53 | [self.view.layer addSublayer:TRVSStillLayer]; 54 | [self.view.layer addSublayer:TRVSTransitioningLayer]; 55 | 56 | [CATransaction flush]; 57 | 58 | [TRVSStillLayer addAnimation: 59 | [self trvs_animationWithTranslation:-CGRectGetWidth(self.view.bounds)] 60 | forKey:nil]; 61 | [TRVSTransitioningLayer addAnimation: 62 | [self trvs_animationWithTranslation:-CGRectGetWidth(self.view.bounds)] 63 | forKey:nil]; 64 | } 65 | 66 | - (void)trvs_popViewControllerWithNavigationControllerTransition { 67 | TRVSStillLayer = [self trvs_layerSnapshotWithTransform:CATransform3DIdentity]; 68 | 69 | [self popViewControllerAnimated:NO]; 70 | 71 | TRVSTransitioningLayer = 72 | [self trvs_layerSnapshotWithTransform:CATransform3DIdentity]; 73 | TRVSTransitioningLayer.frame = (CGRect) { 74 | {-CGRectGetWidth(self.view.bounds), CGRectGetMinY(self.view.bounds)}, 75 | self.view.bounds.size}; 76 | 77 | [self.view.layer addSublayer:TRVSStillLayer]; 78 | [self.view.layer addSublayer:TRVSTransitioningLayer]; 79 | 80 | [CATransaction flush]; 81 | 82 | [TRVSStillLayer addAnimation: 83 | [self trvs_animationWithTranslation:CGRectGetWidth(self.view.bounds)] 84 | forKey:nil]; 85 | [TRVSTransitioningLayer addAnimation: 86 | [self trvs_animationWithTranslation:CGRectGetWidth(self.view.bounds)] 87 | forKey:nil]; 88 | } 89 | 90 | #pragma mark - Private 91 | 92 | - (CABasicAnimation *)trvs_animationWithTranslation:(CGFloat)translation { 93 | CABasicAnimation *animation = 94 | [CABasicAnimation animationWithKeyPath:@"transform"]; 95 | animation.toValue = [NSValue 96 | valueWithCATransform3D:CATransform3DTranslate( 97 | CATransform3DIdentity, translation, 0.f, 0.f)]; 98 | animation.duration = TRVSTransitionDuration; 99 | animation.delegate = 100 | [TRVSNavigationControllerTransitionAnimiationDelegate sharedDelegate]; 101 | animation.removedOnCompletion = NO; 102 | animation.fillMode = kCAFillModeForwards; 103 | animation.timingFunction = 104 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 105 | 106 | return animation; 107 | } 108 | 109 | - (CALayer *)trvs_layerSnapshotWithTransform:(CATransform3D)transform { 110 | if (UIGraphicsBeginImageContextWithOptions) { 111 | UIGraphicsBeginImageContextWithOptions( 112 | self.view.bounds.size, NO, [UIScreen mainScreen].scale); 113 | } else { 114 | UIGraphicsBeginImageContext(self.view.bounds.size); 115 | } 116 | 117 | [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; 118 | 119 | UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); 120 | 121 | UIGraphicsEndImageContext(); 122 | 123 | CALayer *snapshotLayer = [CALayer layer]; 124 | snapshotLayer.transform = transform; 125 | snapshotLayer.anchorPoint = CGPointMake(1.f, 1.f); 126 | snapshotLayer.frame = self.view.bounds; 127 | snapshotLayer.contents = (id)snapshot.CGImage; 128 | 129 | return snapshotLayer; 130 | } 131 | 132 | @end 133 | --------------------------------------------------------------------------------