├── .gitignore ├── stackedViewControllers.xcodeproj └── project.pbxproj └── stackedViewControllers ├── AppDelegate.h ├── AppDelegate.m ├── ViewController.h ├── ViewController.m ├── childViewController.h ├── childViewController.m ├── childViewController.xib ├── en.lproj ├── InfoPlist.strings ├── ViewController_iPad.xib └── ViewController_iPhone.xib ├── main.m ├── stackedViewControllers-Info.plist └── stackedViewControllers-Prefix.pch /.gitignore: -------------------------------------------------------------------------------- 1 | # xcode noise 2 | *.mode1v3 3 | *.pbxuser 4 | *.perspective 5 | *.perspectivev3 6 | *.pyc 7 | *~.nib/ 8 | build/* 9 | project.xcworkspace/ 10 | xcuserdata/ 11 | 12 | # Textmate - if you build your xcode projects with it 13 | *.tm_build_errors 14 | 15 | # old skool 16 | .svn 17 | 18 | # osx noise 19 | .DS_Store 20 | profile -------------------------------------------------------------------------------- /stackedViewControllers.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | EC058A96147873EE00601AF5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC058A95147873EE00601AF5 /* UIKit.framework */; }; 11 | EC058A98147873EE00601AF5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC058A97147873EE00601AF5 /* Foundation.framework */; }; 12 | EC058A9A147873EE00601AF5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC058A99147873EE00601AF5 /* CoreGraphics.framework */; }; 13 | EC058AA0147873EE00601AF5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EC058A9E147873EE00601AF5 /* InfoPlist.strings */; }; 14 | EC058AA2147873EE00601AF5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EC058AA1147873EE00601AF5 /* main.m */; }; 15 | EC058AA6147873EE00601AF5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EC058AA5147873EE00601AF5 /* AppDelegate.m */; }; 16 | EC058AA9147873EE00601AF5 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC058AA8147873EE00601AF5 /* ViewController.m */; }; 17 | EC058AAC147873EE00601AF5 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC058AAA147873EE00601AF5 /* ViewController_iPhone.xib */; }; 18 | EC058AAF147873EE00601AF5 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC058AAD147873EE00601AF5 /* ViewController_iPad.xib */; }; 19 | EC058AB8147874E300601AF5 /* childViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC058AB6147874E300601AF5 /* childViewController.m */; }; 20 | EC058AB9147874E300601AF5 /* childViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC058AB7147874E300601AF5 /* childViewController.xib */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | EC058A91147873EE00601AF5 /* stackedViewControllers.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = stackedViewControllers.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | EC058A95147873EE00601AF5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 26 | EC058A97147873EE00601AF5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 27 | EC058A99147873EE00601AF5 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 28 | EC058A9D147873EE00601AF5 /* stackedViewControllers-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "stackedViewControllers-Info.plist"; sourceTree = ""; }; 29 | EC058A9F147873EE00601AF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 30 | EC058AA1147873EE00601AF5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 31 | EC058AA3147873EE00601AF5 /* stackedViewControllers-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "stackedViewControllers-Prefix.pch"; sourceTree = ""; }; 32 | EC058AA4147873EE00601AF5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 33 | EC058AA5147873EE00601AF5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 34 | EC058AA7147873EE00601AF5 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 35 | EC058AA8147873EE00601AF5 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 36 | EC058AAB147873EE00601AF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = ""; }; 37 | EC058AAE147873EE00601AF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = ""; }; 38 | EC058AB5147874E300601AF5 /* childViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = childViewController.h; sourceTree = ""; }; 39 | EC058AB6147874E300601AF5 /* childViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = childViewController.m; sourceTree = ""; }; 40 | EC058AB7147874E300601AF5 /* childViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = childViewController.xib; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | EC058A8E147873EE00601AF5 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | EC058A96147873EE00601AF5 /* UIKit.framework in Frameworks */, 49 | EC058A98147873EE00601AF5 /* Foundation.framework in Frameworks */, 50 | EC058A9A147873EE00601AF5 /* CoreGraphics.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | EC058A86147873ED00601AF5 = { 58 | isa = PBXGroup; 59 | children = ( 60 | EC058A9B147873EE00601AF5 /* stackedViewControllers */, 61 | EC058A94147873EE00601AF5 /* Frameworks */, 62 | EC058A92147873EE00601AF5 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | EC058A92147873EE00601AF5 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | EC058A91147873EE00601AF5 /* stackedViewControllers.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | EC058A94147873EE00601AF5 /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | EC058A95147873EE00601AF5 /* UIKit.framework */, 78 | EC058A97147873EE00601AF5 /* Foundation.framework */, 79 | EC058A99147873EE00601AF5 /* CoreGraphics.framework */, 80 | ); 81 | name = Frameworks; 82 | sourceTree = ""; 83 | }; 84 | EC058A9B147873EE00601AF5 /* stackedViewControllers */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | EC058AA4147873EE00601AF5 /* AppDelegate.h */, 88 | EC058AA5147873EE00601AF5 /* AppDelegate.m */, 89 | EC058AA7147873EE00601AF5 /* ViewController.h */, 90 | EC058AA8147873EE00601AF5 /* ViewController.m */, 91 | EC058AB5147874E300601AF5 /* childViewController.h */, 92 | EC058AB6147874E300601AF5 /* childViewController.m */, 93 | EC058AB7147874E300601AF5 /* childViewController.xib */, 94 | EC058AAA147873EE00601AF5 /* ViewController_iPhone.xib */, 95 | EC058AAD147873EE00601AF5 /* ViewController_iPad.xib */, 96 | EC058A9C147873EE00601AF5 /* Supporting Files */, 97 | ); 98 | path = stackedViewControllers; 99 | sourceTree = ""; 100 | }; 101 | EC058A9C147873EE00601AF5 /* Supporting Files */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | EC058A9D147873EE00601AF5 /* stackedViewControllers-Info.plist */, 105 | EC058A9E147873EE00601AF5 /* InfoPlist.strings */, 106 | EC058AA1147873EE00601AF5 /* main.m */, 107 | EC058AA3147873EE00601AF5 /* stackedViewControllers-Prefix.pch */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | /* End PBXGroup section */ 113 | 114 | /* Begin PBXNativeTarget section */ 115 | EC058A90147873EE00601AF5 /* stackedViewControllers */ = { 116 | isa = PBXNativeTarget; 117 | buildConfigurationList = EC058AB2147873EE00601AF5 /* Build configuration list for PBXNativeTarget "stackedViewControllers" */; 118 | buildPhases = ( 119 | EC058A8D147873EE00601AF5 /* Sources */, 120 | EC058A8E147873EE00601AF5 /* Frameworks */, 121 | EC058A8F147873EE00601AF5 /* Resources */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = stackedViewControllers; 128 | productName = stackedViewControllers; 129 | productReference = EC058A91147873EE00601AF5 /* stackedViewControllers.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | EC058A88147873ED00601AF5 /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 0440; 139 | ORGANIZATIONNAME = "Big Diggy SW"; 140 | }; 141 | buildConfigurationList = EC058A8B147873ED00601AF5 /* Build configuration list for PBXProject "stackedViewControllers" */; 142 | compatibilityVersion = "Xcode 3.2"; 143 | developmentRegion = English; 144 | hasScannedForEncodings = 0; 145 | knownRegions = ( 146 | en, 147 | ); 148 | mainGroup = EC058A86147873ED00601AF5; 149 | productRefGroup = EC058A92147873EE00601AF5 /* Products */; 150 | projectDirPath = ""; 151 | projectRoot = ""; 152 | targets = ( 153 | EC058A90147873EE00601AF5 /* stackedViewControllers */, 154 | ); 155 | }; 156 | /* End PBXProject section */ 157 | 158 | /* Begin PBXResourcesBuildPhase section */ 159 | EC058A8F147873EE00601AF5 /* Resources */ = { 160 | isa = PBXResourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | EC058AA0147873EE00601AF5 /* InfoPlist.strings in Resources */, 164 | EC058AAC147873EE00601AF5 /* ViewController_iPhone.xib in Resources */, 165 | EC058AAF147873EE00601AF5 /* ViewController_iPad.xib in Resources */, 166 | EC058AB9147874E300601AF5 /* childViewController.xib in Resources */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXSourcesBuildPhase section */ 173 | EC058A8D147873EE00601AF5 /* Sources */ = { 174 | isa = PBXSourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | EC058AA2147873EE00601AF5 /* main.m in Sources */, 178 | EC058AA6147873EE00601AF5 /* AppDelegate.m in Sources */, 179 | EC058AA9147873EE00601AF5 /* ViewController.m in Sources */, 180 | EC058AB8147874E300601AF5 /* childViewController.m in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | EC058A9E147873EE00601AF5 /* InfoPlist.strings */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | EC058A9F147873EE00601AF5 /* en */, 191 | ); 192 | name = InfoPlist.strings; 193 | sourceTree = ""; 194 | }; 195 | EC058AAA147873EE00601AF5 /* ViewController_iPhone.xib */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | EC058AAB147873EE00601AF5 /* en */, 199 | ); 200 | name = ViewController_iPhone.xib; 201 | sourceTree = ""; 202 | }; 203 | EC058AAD147873EE00601AF5 /* ViewController_iPad.xib */ = { 204 | isa = PBXVariantGroup; 205 | children = ( 206 | EC058AAE147873EE00601AF5 /* en */, 207 | ); 208 | name = ViewController_iPad.xib; 209 | sourceTree = ""; 210 | }; 211 | /* End PBXVariantGroup section */ 212 | 213 | /* Begin XCBuildConfiguration section */ 214 | EC058AB0147873EE00601AF5 /* Debug */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | ALWAYS_SEARCH_USER_PATHS = NO; 218 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 219 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 220 | COPY_PHASE_STRIP = NO; 221 | GCC_C_LANGUAGE_STANDARD = gnu99; 222 | GCC_DYNAMIC_NO_PIC = NO; 223 | GCC_OPTIMIZATION_LEVEL = 0; 224 | GCC_PREPROCESSOR_DEFINITIONS = ( 225 | "DEBUG=1", 226 | "$(inherited)", 227 | ); 228 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 229 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 230 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 234 | SDKROOT = iphoneos; 235 | TARGETED_DEVICE_FAMILY = "1,2"; 236 | }; 237 | name = Debug; 238 | }; 239 | EC058AB1147873EE00601AF5 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | ALWAYS_SEARCH_USER_PATHS = NO; 243 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 244 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 245 | COPY_PHASE_STRIP = YES; 246 | GCC_C_LANGUAGE_STANDARD = gnu99; 247 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 248 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 250 | GCC_WARN_UNUSED_VARIABLE = YES; 251 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 252 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 253 | SDKROOT = iphoneos; 254 | TARGETED_DEVICE_FAMILY = "1,2"; 255 | VALIDATE_PRODUCT = YES; 256 | }; 257 | name = Release; 258 | }; 259 | EC058AB3147873EE00601AF5 /* Debug */ = { 260 | isa = XCBuildConfiguration; 261 | buildSettings = { 262 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 263 | GCC_PREFIX_HEADER = "stackedViewControllers/stackedViewControllers-Prefix.pch"; 264 | INFOPLIST_FILE = "stackedViewControllers/stackedViewControllers-Info.plist"; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | WRAPPER_EXTENSION = app; 267 | }; 268 | name = Debug; 269 | }; 270 | EC058AB4147873EE00601AF5 /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 274 | GCC_PREFIX_HEADER = "stackedViewControllers/stackedViewControllers-Prefix.pch"; 275 | INFOPLIST_FILE = "stackedViewControllers/stackedViewControllers-Info.plist"; 276 | PRODUCT_NAME = "$(TARGET_NAME)"; 277 | WRAPPER_EXTENSION = app; 278 | }; 279 | name = Release; 280 | }; 281 | /* End XCBuildConfiguration section */ 282 | 283 | /* Begin XCConfigurationList section */ 284 | EC058A8B147873ED00601AF5 /* Build configuration list for PBXProject "stackedViewControllers" */ = { 285 | isa = XCConfigurationList; 286 | buildConfigurations = ( 287 | EC058AB0147873EE00601AF5 /* Debug */, 288 | EC058AB1147873EE00601AF5 /* Release */, 289 | ); 290 | defaultConfigurationIsVisible = 0; 291 | defaultConfigurationName = Release; 292 | }; 293 | EC058AB2147873EE00601AF5 /* Build configuration list for PBXNativeTarget "stackedViewControllers" */ = { 294 | isa = XCConfigurationList; 295 | buildConfigurations = ( 296 | EC058AB3147873EE00601AF5 /* Debug */, 297 | EC058AB4147873EE00601AF5 /* Release */, 298 | ); 299 | defaultConfigurationIsVisible = 0; 300 | defaultConfigurationName = Release; 301 | }; 302 | /* End XCConfigurationList section */ 303 | }; 304 | rootObject = EC058A88147873ED00601AF5 /* Project object */; 305 | } 306 | -------------------------------------------------------------------------------- /stackedViewControllers/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /stackedViewControllers/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | @synthesize window = _window; 16 | @synthesize viewController = _viewController; 17 | 18 | - (void)dealloc 19 | { 20 | [_window release]; 21 | [_viewController release]; 22 | [super dealloc]; 23 | } 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 28 | // Override point for customization after application launch. 29 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 30 | self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease]; 31 | } else { 32 | self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease]; 33 | } 34 | self.window.rootViewController = self.viewController; 35 | [self.window makeKeyAndVisible]; 36 | return YES; 37 | } 38 | 39 | - (void)applicationWillResignActive:(UIApplication *)application 40 | { 41 | /* 42 | 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. 43 | 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. 44 | */ 45 | } 46 | 47 | - (void)applicationDidEnterBackground:(UIApplication *)application 48 | { 49 | /* 50 | 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. 51 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 52 | */ 53 | } 54 | 55 | - (void)applicationWillEnterForeground:(UIApplication *)application 56 | { 57 | /* 58 | 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. 59 | */ 60 | } 61 | 62 | - (void)applicationDidBecomeActive:(UIApplication *)application 63 | { 64 | /* 65 | 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. 66 | */ 67 | } 68 | 69 | - (void)applicationWillTerminate:(UIApplication *)application 70 | { 71 | /* 72 | Called when the application is about to terminate. 73 | Save data if appropriate. 74 | See also applicationDidEnterBackground:. 75 | */ 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /stackedViewControllers/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import 10 | @class childViewController; 11 | @interface ViewController : UIViewController 12 | @property (nonatomic,retain) childViewController *currentViewController; 13 | @property NSInteger childNumber; 14 | 15 | -(void)swapViewControllers; 16 | -(void)pushViewControllers; 17 | @end 18 | -------------------------------------------------------------------------------- /stackedViewControllers/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "childViewController.h" 11 | 12 | @implementation ViewController 13 | @synthesize currentViewController = currentViewController_; 14 | @synthesize childNumber; 15 | - (void)didReceiveMemoryWarning 16 | { 17 | [super didReceiveMemoryWarning]; 18 | // Release any cached data, images, etc that aren't in use. 19 | } 20 | 21 | #pragma mark - View lifecycle 22 | 23 | - (void)viewDidLoad 24 | { 25 | [super viewDidLoad]; 26 | childNumber=0; 27 | // Do any additional setup after loading the view, typically from a nib. 28 | NSLog(@"ViewController: %@",self); 29 | currentViewController_ = [[childViewController alloc] initWithNibName:@"childViewController" bundle:nil]; 30 | 31 | [self addChildViewController:self.currentViewController]; 32 | currentViewController_.view.frame=self.view.bounds; 33 | [self.view addSubview:self.currentViewController.view]; 34 | [self.currentViewController didMoveToParentViewController:self]; 35 | [self.currentViewController.swapViewControllerButton setTitle:@"Swap" forState:UIControlStateNormal]; 36 | 37 | self.currentViewController.childNumberLabel.text=[NSString stringWithFormat:@"Child Number: %d",self.childNumber]; 38 | 39 | 40 | 41 | } 42 | 43 | #pragma mark - 44 | #pragma mark UIViewController Container Methods 45 | - (BOOL)shouldAutomaticallyForwardRotationMethods{ 46 | return YES; 47 | } 48 | 49 | -(void)swapViewControllers{ 50 | childViewController *aNewViewController = [[childViewController alloc] initWithNibName:@"childViewController" bundle:nil] ; 51 | 52 | childNumber++; 53 | [aNewViewController.view layoutIfNeeded]; 54 | [aNewViewController.swapViewControllerButton setTitle:@"Swap" forState:UIControlStateNormal]; 55 | aNewViewController.childNumberLabel.text=[NSString stringWithFormat:@"Child Number: %d",self.childNumber]; 56 | 57 | aNewViewController.view.frame=self.view.bounds; 58 | [self.currentViewController willMoveToParentViewController:nil]; 59 | [self addChildViewController:aNewViewController]; 60 | 61 | __weak __block ViewController *weakSelf=self; 62 | [self transitionFromViewController:self.currentViewController 63 | toViewController:aNewViewController 64 | duration:1.0 65 | options:UIViewAnimationOptionTransitionCurlUp 66 | animations:nil 67 | completion:^(BOOL finished) { 68 | 69 | [weakSelf.currentViewController removeFromParentViewController]; 70 | [aNewViewController didMoveToParentViewController:weakSelf]; 71 | 72 | weakSelf.currentViewController=[aNewViewController autorelease]; 73 | }]; 74 | } 75 | 76 | -(void)pushViewControllers{ 77 | childViewController *aNewViewController = [[childViewController alloc] initWithNibName:@"childViewController" bundle:nil] ; 78 | 79 | childNumber++; 80 | 81 | [aNewViewController.view layoutIfNeeded]; 82 | aNewViewController.childNumberLabel.text=[NSString stringWithFormat:@"Child Number: %d",self.childNumber]; 83 | 84 | CGRect inputViewFrame=self.view.bounds; 85 | CGFloat inputViewWidth=inputViewFrame.size.width; 86 | 87 | CGRect newFrame=CGRectMake(self.view.bounds.size.width, 0, inputViewFrame.size.width, inputViewFrame.size.height); 88 | 89 | aNewViewController.view.frame=newFrame; 90 | 91 | [self.currentViewController willMoveToParentViewController:nil]; 92 | [self addChildViewController:aNewViewController]; 93 | [self.view addSubview:aNewViewController.view]; 94 | 95 | [self.currentViewController willMoveToParentViewController:nil]; 96 | 97 | CGRect offSetRect=CGRectOffset(newFrame, -inputViewWidth, 0.0f); 98 | CGRect otherOffsetRect=CGRectOffset(self.currentViewController.view.frame, -inputViewWidth, 0.0f); 99 | 100 | __weak __block ViewController *weakSelf=self; 101 | [UIView animateWithDuration:0.4f animations:^{ 102 | aNewViewController.view.frame=offSetRect; 103 | weakSelf.currentViewController.view.frame=otherOffsetRect; 104 | } 105 | completion:^(BOOL finished){ 106 | 107 | [weakSelf.currentViewController.view removeFromSuperview]; 108 | [weakSelf.currentViewController removeFromParentViewController]; 109 | [aNewViewController didMoveToParentViewController:weakSelf]; 110 | 111 | weakSelf.currentViewController=[aNewViewController autorelease]; 112 | }]; 113 | 114 | } 115 | 116 | 117 | - (void)viewDidUnload 118 | { 119 | [super viewDidUnload]; 120 | // Release any retained subviews of the main view. 121 | // e.g. self.myOutlet = nil; 122 | } 123 | 124 | - (void)viewWillAppear:(BOOL)animated 125 | { 126 | [super viewWillAppear:animated]; 127 | } 128 | 129 | - (void)viewDidAppear:(BOOL)animated 130 | { 131 | [super viewDidAppear:animated]; 132 | } 133 | 134 | - (void)viewWillDisappear:(BOOL)animated 135 | { 136 | [super viewWillDisappear:animated]; 137 | } 138 | 139 | - (void)viewDidDisappear:(BOOL)animated 140 | { 141 | [super viewDidDisappear:animated]; 142 | } 143 | 144 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 145 | { 146 | // Return YES for supported orientations 147 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 148 | return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 149 | } else { 150 | return YES; 151 | } 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /stackedViewControllers/childViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // childViewController.h 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface childViewController : UIViewController 12 | @property (retain, nonatomic) IBOutlet UIButton *swapViewControllerButton; 13 | - (IBAction)swapViewController:(id)sender; 14 | - (IBAction)pushViewController:(id)sender; 15 | @property (retain, nonatomic) IBOutlet UILabel *childNumberLabel; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /stackedViewControllers/childViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // childViewController.m 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. All rights reserved. 7 | // 8 | 9 | #import "childViewController.h" 10 | #import "ViewController.h" 11 | 12 | @implementation childViewController 13 | @synthesize childNumberLabel; 14 | @synthesize swapViewControllerButton; 15 | 16 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 17 | { 18 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 19 | if (self) { 20 | // Custom initialization 21 | } 22 | return self; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning 26 | { 27 | // Releases the view if it doesn't have a superview. 28 | [super didReceiveMemoryWarning]; 29 | 30 | // Release any cached data, images, etc that aren't in use. 31 | } 32 | 33 | #pragma mark - View lifecycle 34 | 35 | - (void)viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | // Do any additional setup after loading the view from its nib. 39 | } 40 | 41 | - (void)viewDidUnload 42 | { 43 | [self setSwapViewControllerButton:nil]; 44 | [self setChildNumberLabel:nil]; 45 | [super viewDidUnload]; 46 | // Release any retained subviews of the main view. 47 | // e.g. self.myOutlet = nil; 48 | } 49 | 50 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 51 | { 52 | // Return YES for supported orientations 53 | return YES; 54 | } 55 | 56 | - (void)dealloc { 57 | [swapViewControllerButton release]; 58 | [childNumberLabel release]; 59 | [super dealloc]; 60 | } 61 | - (IBAction)swapViewController:(id)sender { 62 | [(ViewController *)self.parentViewController swapViewControllers]; 63 | } 64 | 65 | - (IBAction)pushViewController:(id)sender{ 66 | [(ViewController *)self.parentViewController pushViewControllers]; 67 | } 68 | @end 69 | -------------------------------------------------------------------------------- /stackedViewControllers/childViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12D78 6 | 3084 7 | 1187.37 8 | 626.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBProxyObject 15 | IBUIButton 16 | IBUILabel 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 293 42 | {{74, 15}, {173, 37}} 43 | 44 | 45 | 46 | _NS:225 47 | NO 48 | IBCocoaTouchFramework 49 | 0 50 | 0 51 | 1 52 | Swap 53 | 54 | 3 55 | MQA 56 | 57 | 58 | 1 59 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 60 | 61 | 62 | 3 63 | MC41AA 64 | 65 | 66 | 2 67 | 15 68 | 69 | 70 | Helvetica-Bold 71 | 15 72 | 16 73 | 74 | 75 | 76 | 77 | 293 78 | {{74, 71}, {173, 37}} 79 | 80 | 81 | 82 | _NS:225 83 | NO 84 | IBCocoaTouchFramework 85 | 0 86 | 0 87 | 1 88 | Push 89 | 90 | 91 | 1 92 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 293 101 | {{59, 131}, {203, 21}} 102 | 103 | 104 | _NS:9 105 | NO 106 | YES 107 | 7 108 | NO 109 | IBCocoaTouchFramework 110 | Label 111 | 112 | 1 113 | MCAwIDAAA 114 | darkTextColor 115 | 116 | 117 | 0 118 | 10 119 | 1 120 | 121 | 1 122 | 17 123 | 124 | 125 | Helvetica 126 | 17 127 | 16 128 | 129 | 130 | 131 | {{0, 20}, {320, 460}} 132 | 133 | 134 | 135 | 136 | 3 137 | MQA 138 | 139 | 2 140 | 141 | 142 | 143 | IBCocoaTouchFramework 144 | 145 | 146 | 147 | 148 | 149 | 150 | view 151 | 152 | 153 | 154 | 3 155 | 156 | 157 | 158 | swapViewControllerButton 159 | 160 | 161 | 162 | 7 163 | 164 | 165 | 166 | childNumberLabel 167 | 168 | 169 | 170 | 9 171 | 172 | 173 | 174 | swapViewController: 175 | 176 | 177 | 7 178 | 179 | 6 180 | 181 | 182 | 183 | pushViewController: 184 | 185 | 186 | 7 187 | 188 | 12 189 | 190 | 191 | 192 | 193 | 194 | 0 195 | 196 | 197 | 198 | 199 | 200 | 1 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | -1 211 | 212 | 213 | File's Owner 214 | 215 | 216 | -2 217 | 218 | 219 | 220 | 221 | 4 222 | 223 | 224 | 225 | 226 | 8 227 | 228 | 229 | 230 | 231 | 10 232 | 233 | 234 | 235 | 236 | 237 | 238 | childViewController 239 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 240 | UIResponder 241 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 242 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 243 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 244 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 245 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 246 | 247 | 248 | 249 | 250 | 251 | 12 252 | 253 | 254 | 255 | 256 | childViewController 257 | UIViewController 258 | 259 | id 260 | id 261 | 262 | 263 | 264 | pushViewController: 265 | id 266 | 267 | 268 | swapViewController: 269 | id 270 | 271 | 272 | 273 | UILabel 274 | UIButton 275 | 276 | 277 | 278 | childNumberLabel 279 | UILabel 280 | 281 | 282 | swapViewControllerButton 283 | UIButton 284 | 285 | 286 | 287 | IBProjectSource 288 | ./Classes/childViewController.h 289 | 290 | 291 | 292 | 293 | 0 294 | IBCocoaTouchFramework 295 | 296 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 297 | 298 | 299 | YES 300 | 3 301 | 2083 302 | 303 | 304 | -------------------------------------------------------------------------------- /stackedViewControllers/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /stackedViewControllers/en.lproj/ViewController_iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C25 6 | 1919 7 | 1138.11 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 916 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBIPadFramework 28 | 29 | 30 | IBFirstResponder 31 | IBIPadFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {768, 1004}} 37 | 38 | 39 | 40 | 3 41 | MQA 42 | 43 | 2 44 | 45 | 46 | 47 | 2 48 | 49 | IBIPadFramework 50 | 51 | 52 | 53 | 54 | 55 | 56 | view 57 | 58 | 59 | 60 | 3 61 | 62 | 63 | 64 | 65 | 66 | 0 67 | 68 | 69 | 70 | 71 | 72 | -1 73 | 74 | 75 | File's Owner 76 | 77 | 78 | -2 79 | 80 | 81 | 82 | 83 | 2 84 | 85 | 86 | 87 | 88 | 89 | 90 | ViewController 91 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 92 | UIResponder 93 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 94 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 95 | 96 | 97 | 98 | 99 | 100 | 3 101 | 102 | 103 | 104 | 105 | ViewController 106 | UIViewController 107 | 108 | IBProjectSource 109 | ./Classes/ViewController.h 110 | 111 | 112 | 113 | 114 | 0 115 | IBIPadFramework 116 | YES 117 | 3 118 | 916 119 | 120 | 121 | -------------------------------------------------------------------------------- /stackedViewControllers/en.lproj/ViewController_iPhone.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1280 5 | 11C25 6 | 1919 7 | 1138.11 8 | 566.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 916 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {320, 460}} 37 | 38 | 39 | 40 | 3 41 | MC43NQA 42 | 43 | 2 44 | 45 | 46 | NO 47 | 48 | IBCocoaTouchFramework 49 | 50 | 51 | 52 | 53 | 54 | 55 | view 56 | 57 | 58 | 59 | 7 60 | 61 | 62 | 63 | 64 | 65 | 0 66 | 67 | 68 | 69 | 70 | 71 | -1 72 | 73 | 74 | File's Owner 75 | 76 | 77 | -2 78 | 79 | 80 | 81 | 82 | 6 83 | 84 | 85 | 86 | 87 | 88 | 89 | ViewController 90 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 91 | UIResponder 92 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 93 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 94 | 95 | 96 | 97 | 98 | 99 | 7 100 | 101 | 102 | 103 | 104 | ViewController 105 | UIViewController 106 | 107 | IBProjectSource 108 | ./Classes/ViewController.h 109 | 110 | 111 | 112 | 113 | 0 114 | IBCocoaTouchFramework 115 | YES 116 | 3 117 | 916 118 | 119 | 120 | -------------------------------------------------------------------------------- /stackedViewControllers/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // stackedViewControllers 4 | // 5 | // Created by Tim and Jennifer Taylor on 11/19/11. 6 | // Copyright (c) 2011 Big Diggy SW. 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 | -------------------------------------------------------------------------------- /stackedViewControllers/stackedViewControllers-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFiles 12 | 13 | CFBundleIdentifier 14 | com.bigdiggy.${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 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /stackedViewControllers/stackedViewControllers-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'stackedViewControllers' target in the 'stackedViewControllers' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | --------------------------------------------------------------------------------