diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cf7ddc --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# xcode noise +build/* +*.pbxuser +*.mode1v3 +*.xcworkspace +xcuserdata +project.xcworkspace/* +xcuserdata/* + +# osx noise +.DS_Store +profile \ No newline at end of file diff --git a/ViewDeckExample.xcodeproj/project.pbxproj b/ViewDeckExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..845328d --- /dev/null +++ b/ViewDeckExample.xcodeproj/project.pbxproj @@ -0,0 +1,324 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E240A9AC148AB3770077282A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E240A9AB148AB3770077282A /* UIKit.framework */; }; + E240A9AE148AB3770077282A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E240A9AD148AB3770077282A /* Foundation.framework */; }; + E240A9B0148AB3770077282A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E240A9AF148AB3770077282A /* CoreGraphics.framework */; }; + E240A9B6148AB3770077282A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E240A9B4148AB3770077282A /* InfoPlist.strings */; }; + E240A9B8148AB3770077282A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9B7148AB3770077282A /* main.m */; }; + E240A9BC148AB3770077282A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9BB148AB3770077282A /* AppDelegate.m */; }; + E240A9BF148AB3770077282A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9BE148AB3770077282A /* ViewController.m */; }; + E240A9C2148AB3770077282A /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E240A9C0148AB3770077282A /* ViewController.xib */; }; + E240A9CC148AB4B60077282A /* IIViewDeckController.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9CB148AB4B60077282A /* IIViewDeckController.m */; }; + E240A9D2148ADC020077282A /* LeftViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9D0148ADC020077282A /* LeftViewController.m */; }; + E240A9D3148ADC020077282A /* LeftViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E240A9D1148ADC020077282A /* LeftViewController.xib */; }; + E240A9D7148ADC230077282A /* RightViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E240A9D5148ADC230077282A /* RightViewController.m */; }; + E240A9D8148ADC230077282A /* RightViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E240A9D6148ADC230077282A /* RightViewController.xib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E240A9A7148AB3770077282A /* ViewDeckExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ViewDeckExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E240A9AB148AB3770077282A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + E240A9AD148AB3770077282A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + E240A9AF148AB3770077282A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + E240A9B3148AB3770077282A /* ViewDeckExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ViewDeckExample-Info.plist"; sourceTree = ""; }; + E240A9B5148AB3770077282A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + E240A9B7148AB3770077282A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + E240A9B9148AB3770077282A /* ViewDeckExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ViewDeckExample-Prefix.pch"; sourceTree = ""; }; + E240A9BA148AB3770077282A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + E240A9BB148AB3770077282A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + E240A9BD148AB3770077282A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + E240A9BE148AB3770077282A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + E240A9C1148AB3770077282A /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; + E240A9CA148AB4B60077282A /* IIViewDeckController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IIViewDeckController.h; path = vendor/ViewDeck/IIViewDeckController.h; sourceTree = ""; }; + E240A9CB148AB4B60077282A /* IIViewDeckController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IIViewDeckController.m; path = vendor/ViewDeck/IIViewDeckController.m; sourceTree = ""; }; + E240A9CF148ADC020077282A /* LeftViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeftViewController.h; sourceTree = ""; }; + E240A9D0148ADC020077282A /* LeftViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeftViewController.m; sourceTree = ""; }; + E240A9D1148ADC020077282A /* LeftViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LeftViewController.xib; sourceTree = ""; }; + E240A9D4148ADC230077282A /* RightViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RightViewController.h; sourceTree = ""; }; + E240A9D5148ADC230077282A /* RightViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RightViewController.m; sourceTree = ""; }; + E240A9D6148ADC230077282A /* RightViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RightViewController.xib; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E240A9A4148AB3770077282A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E240A9AC148AB3770077282A /* UIKit.framework in Frameworks */, + E240A9AE148AB3770077282A /* Foundation.framework in Frameworks */, + E240A9B0148AB3770077282A /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E240A99C148AB3770077282A = { + isa = PBXGroup; + children = ( + E240A9B1148AB3770077282A /* ViewDeckExample */, + E240A9AA148AB3770077282A /* Frameworks */, + E240A9A8148AB3770077282A /* Products */, + ); + sourceTree = ""; + }; + E240A9A8148AB3770077282A /* Products */ = { + isa = PBXGroup; + children = ( + E240A9A7148AB3770077282A /* ViewDeckExample.app */, + ); + name = Products; + sourceTree = ""; + }; + E240A9AA148AB3770077282A /* Frameworks */ = { + isa = PBXGroup; + children = ( + E240A9AB148AB3770077282A /* UIKit.framework */, + E240A9AD148AB3770077282A /* Foundation.framework */, + E240A9AF148AB3770077282A /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + E240A9B1148AB3770077282A /* ViewDeckExample */ = { + isa = PBXGroup; + children = ( + E240A9B2148AB3770077282A /* Supporting Files */, + E240A9C8148AB3F70077282A /* vendor */, + E240A9BA148AB3770077282A /* AppDelegate.h */, + E240A9BB148AB3770077282A /* AppDelegate.m */, + E240A9BD148AB3770077282A /* ViewController.h */, + E240A9BE148AB3770077282A /* ViewController.m */, + E240A9C0148AB3770077282A /* ViewController.xib */, + E240A9CF148ADC020077282A /* LeftViewController.h */, + E240A9D0148ADC020077282A /* LeftViewController.m */, + E240A9D1148ADC020077282A /* LeftViewController.xib */, + E240A9D4148ADC230077282A /* RightViewController.h */, + E240A9D5148ADC230077282A /* RightViewController.m */, + E240A9D6148ADC230077282A /* RightViewController.xib */, + ); + path = ViewDeckExample; + sourceTree = ""; + }; + E240A9B2148AB3770077282A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E240A9B3148AB3770077282A /* ViewDeckExample-Info.plist */, + E240A9B4148AB3770077282A /* InfoPlist.strings */, + E240A9B7148AB3770077282A /* main.m */, + E240A9B9148AB3770077282A /* ViewDeckExample-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E240A9C8148AB3F70077282A /* vendor */ = { + isa = PBXGroup; + children = ( + E240A9C9148AB4000077282A /* ViewDeck */, + ); + name = vendor; + sourceTree = ""; + }; + E240A9C9148AB4000077282A /* ViewDeck */ = { + isa = PBXGroup; + children = ( + E240A9CA148AB4B60077282A /* IIViewDeckController.h */, + E240A9CB148AB4B60077282A /* IIViewDeckController.m */, + ); + name = ViewDeck; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E240A9A6148AB3770077282A /* ViewDeckExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = E240A9C5148AB3770077282A /* Build configuration list for PBXNativeTarget "ViewDeckExample" */; + buildPhases = ( + E240A9A3148AB3770077282A /* Sources */, + E240A9A4148AB3770077282A /* Frameworks */, + E240A9A5148AB3770077282A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ViewDeckExample; + productName = ViewDeckExample; + productReference = E240A9A7148AB3770077282A /* ViewDeckExample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E240A99E148AB3770077282A /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + ORGANIZATIONNAME = "Adriaenssen BVBA"; + }; + buildConfigurationList = E240A9A1148AB3770077282A /* Build configuration list for PBXProject "ViewDeckExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = E240A99C148AB3770077282A; + productRefGroup = E240A9A8148AB3770077282A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E240A9A6148AB3770077282A /* ViewDeckExample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E240A9A5148AB3770077282A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E240A9B6148AB3770077282A /* InfoPlist.strings in Resources */, + E240A9C2148AB3770077282A /* ViewController.xib in Resources */, + E240A9D3148ADC020077282A /* LeftViewController.xib in Resources */, + E240A9D8148ADC230077282A /* RightViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E240A9A3148AB3770077282A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E240A9B8148AB3770077282A /* main.m in Sources */, + E240A9BC148AB3770077282A /* AppDelegate.m in Sources */, + E240A9BF148AB3770077282A /* ViewController.m in Sources */, + E240A9CC148AB4B60077282A /* IIViewDeckController.m in Sources */, + E240A9D2148ADC020077282A /* LeftViewController.m in Sources */, + E240A9D7148ADC230077282A /* RightViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + E240A9B4148AB3770077282A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + E240A9B5148AB3770077282A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + E240A9C0148AB3770077282A /* ViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + E240A9C1148AB3770077282A /* en */, + ); + name = ViewController.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E240A9C3148AB3770077282A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + E240A9C4148AB3770077282A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E240A9C6148AB3770077282A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ViewDeckExample/ViewDeckExample-Prefix.pch"; + INFOPLIST_FILE = "ViewDeckExample/ViewDeckExample-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + E240A9C7148AB3770077282A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ViewDeckExample/ViewDeckExample-Prefix.pch"; + INFOPLIST_FILE = "ViewDeckExample/ViewDeckExample-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E240A9A1148AB3770077282A /* Build configuration list for PBXProject "ViewDeckExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E240A9C3148AB3770077282A /* Debug */, + E240A9C4148AB3770077282A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E240A9C5148AB3770077282A /* Build configuration list for PBXNativeTarget "ViewDeckExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E240A9C6148AB3770077282A /* Debug */, + E240A9C7148AB3770077282A /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = E240A99E148AB3770077282A /* Project object */; +} diff --git a/ViewDeckExample/AppDelegate.h b/ViewDeckExample/AppDelegate.h new file mode 100644 index 0000000..1592102 --- /dev/null +++ b/ViewDeckExample/AppDelegate.h @@ -0,0 +1,19 @@ +// +// AppDelegate.h +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +@class ViewController; + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@property (strong, nonatomic) UIViewController *viewController; + +@end diff --git a/ViewDeckExample/AppDelegate.m b/ViewDeckExample/AppDelegate.m new file mode 100644 index 0000000..c3e9582 --- /dev/null +++ b/ViewDeckExample/AppDelegate.m @@ -0,0 +1,80 @@ +// +// AppDelegate.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import "AppDelegate.h" + +#import "ViewController.h" +#import "IIViewDeckController.h" +#import "LeftViewController.h" +#import "RightViewController.h" + +@implementation AppDelegate + +@synthesize window = _window; +@synthesize viewController = _viewController; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + // Override point for customization after application launch. + + LeftViewController* leftController = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil]; + RightViewController* rightController = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil]; + + ViewController* viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; + UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:viewController]; + + self.viewController = [[IIViewDeckController alloc] initWithCenterViewController:navController + leftViewController:leftController + rightViewController:rightController]; + + self.window.rootViewController = self.viewController; + [self.window makeKeyAndVisible]; + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + /* + 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. + 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. + */ +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + /* + 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. + If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + */ +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + /* + 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. + */ +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + /* + 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. + */ +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + /* + Called when the application is about to terminate. + Save data if appropriate. + See also applicationDidEnterBackground:. + */ +} + +@end diff --git a/ViewDeckExample/LeftViewController.h b/ViewDeckExample/LeftViewController.h new file mode 100644 index 0000000..7d241ea --- /dev/null +++ b/ViewDeckExample/LeftViewController.h @@ -0,0 +1,13 @@ +// +// LeftViewController.h +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +@interface LeftViewController : UITableViewController + +@end diff --git a/ViewDeckExample/LeftViewController.m b/ViewDeckExample/LeftViewController.m new file mode 100644 index 0000000..dc9129d --- /dev/null +++ b/ViewDeckExample/LeftViewController.m @@ -0,0 +1,157 @@ +// +// LeftViewController.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import "LeftViewController.h" + +@implementation LeftViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +#pragma mark - View lifecycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 3 + arc4random() % 5; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 3 + arc4random() % 5; +} + +- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + return [NSString stringWithFormat:@"%d", section]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; + } + + cell.textLabel.text = [NSString stringWithFormat:@"%d:%d", indexPath.section, indexPath.row]; + return cell; +} + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath +{ +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Navigation logic may go here. Create and push another view controller. + /* + <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; + // ... + // Pass the selected object to the new view controller. + [self.navigationController pushViewController:detailViewController animated:YES]; + */ +} + +@end diff --git a/ViewDeckExample/LeftViewController.xib b/ViewDeckExample/LeftViewController.xib new file mode 100644 index 0000000..7c2345a --- /dev/null +++ b/ViewDeckExample/LeftViewController.xib @@ -0,0 +1,142 @@ + + + + 1280 + 11C25 + 1919 + 1138.11 + 566.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 916 + + + IBProxyObject + IBUITableView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 460}} + + + + + 3 + MQA + + NO + YES + NO + + IBCocoaTouchFramework + NO + 1 + 0 + YES + 44 + 22 + 22 + + + + + + + view + + + + 5 + + + + dataSource + + + + 6 + + + + delegate + + + + 7 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + + + + + LeftViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 7 + + + + + LeftViewController + UIViewController + + IBProjectSource + ./Classes/LeftViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + 916 + + diff --git a/ViewDeckExample/RightViewController.h b/ViewDeckExample/RightViewController.h new file mode 100644 index 0000000..ad808a6 --- /dev/null +++ b/ViewDeckExample/RightViewController.h @@ -0,0 +1,13 @@ +// +// RightViewController.h +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +@interface RightViewController : UIViewController + +@end diff --git a/ViewDeckExample/RightViewController.m b/ViewDeckExample/RightViewController.m new file mode 100644 index 0000000..bdea6bc --- /dev/null +++ b/ViewDeckExample/RightViewController.m @@ -0,0 +1,51 @@ +// +// RightViewController.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import "RightViewController.h" + +@implementation RightViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +#pragma mark - View lifecycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} + +@end diff --git a/ViewDeckExample/RightViewController.xib b/ViewDeckExample/RightViewController.xib new file mode 100644 index 0000000..f8db0e5 --- /dev/null +++ b/ViewDeckExample/RightViewController.xib @@ -0,0 +1,103 @@ + + + + 1280 + 11C74 + 1938 + 1138.23 + 567.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 933 + + + IBProxyObject + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 460}} + + + 1 + MSAwLjQzNTI5NDEyMTUgMC44MTE3NjQ3MTcxAA + + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + -1 + + + File's Owner + + + -2 + + + + + + + RightViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 3 + + + 0 + IBCocoaTouchFramework + YES + 3 + 933 + + diff --git a/ViewDeckExample/ViewController.h b/ViewDeckExample/ViewController.h new file mode 100644 index 0000000..350df70 --- /dev/null +++ b/ViewDeckExample/ViewController.h @@ -0,0 +1,13 @@ +// +// ViewController.h +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + +@end diff --git a/ViewDeckExample/ViewController.m b/ViewDeckExample/ViewController.m new file mode 100644 index 0000000..7cfe7f2 --- /dev/null +++ b/ViewDeckExample/ViewController.m @@ -0,0 +1,57 @@ +// +// ViewController.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import "ViewController.h" +#import "IIViewDeckController.h" + +@implementation ViewController + +#pragma mark - View lifecycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"left" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleLeftView)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"right" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)]; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; +} + +- (void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; +} + +- (void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); +} + +@end diff --git a/ViewDeckExample/ViewDeckExample-Info.plist b/ViewDeckExample/ViewDeckExample-Info.plist new file mode 100644 index 0000000..4fbb7bb --- /dev/null +++ b/ViewDeckExample/ViewDeckExample-Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFiles + + CFBundleIdentifier + org.inferis.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/ViewDeckExample/ViewDeckExample-Prefix.pch b/ViewDeckExample/ViewDeckExample-Prefix.pch new file mode 100644 index 0000000..65316af --- /dev/null +++ b/ViewDeckExample/ViewDeckExample-Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'ViewDeckExample' target in the 'ViewDeckExample' project +// + +#import + +#ifndef __IPHONE_4_0 +#warning "This project uses features only available in iOS SDK 4.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/ViewDeckExample/en.lproj/InfoPlist.strings b/ViewDeckExample/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/ViewDeckExample/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/ViewDeckExample/en.lproj/ViewController.xib b/ViewDeckExample/en.lproj/ViewController.xib new file mode 100644 index 0000000..e7178e4 --- /dev/null +++ b/ViewDeckExample/en.lproj/ViewController.xib @@ -0,0 +1,119 @@ + + + + 1280 + 11C25 + 1919 + 1138.11 + 566.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 916 + + + IBProxyObject + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 460}} + + + + 3 + MC43NQA + + 2 + + + NO + + IBCocoaTouchFramework + + + + + + + view + + + + 7 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + + + + + ViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 7 + + + + + ViewController + UIViewController + + IBProjectSource + ./Classes/ViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + 916 + + diff --git a/ViewDeckExample/main.m b/ViewDeckExample/main.m new file mode 100644 index 0000000..b283398 --- /dev/null +++ b/ViewDeckExample/main.m @@ -0,0 +1,18 @@ +// +// main.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.h b/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.h new file mode 100644 index 0000000..d4b2011 --- /dev/null +++ b/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.h @@ -0,0 +1,37 @@ +// +// IIViewDeckController.h +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import + +@interface IIViewDeckController : UIViewController + +- (id)initWithCenterViewController:(UIViewController*)centerController; +- (id)initWithCenterViewController:(UIViewController*)centerController leftViewController:(UIViewController*)leftController; +- (id)initWithCenterViewController:(UIViewController*)centerController leftViewController:(UIViewController*)leftController rightViewController:(UIViewController*)rightController; + +- (void)toggleLeftView; +- (void)openLeftView; +- (void)closeLeftView; +- (void)toggleLeftViewAnimated:(BOOL)animated; +- (void)openLeftViewAnimated:(BOOL)animated; +- (void)closeLeftViewAnimated:(BOOL)animated; + +- (void)toggleRightView; +- (void)openRightView; +- (void)closeRightView; +- (void)toggleRightViewAnimated:(BOOL)animated; +- (void)openRightViewAnimated:(BOOL)animated; +- (void)closeRightViewAnimated:(BOOL)animated; + +@end + +@interface UIViewController (Stuff) + +@property(nonatomic,readonly,retain) IIViewDeckController *viewDeckController; // If this view controller has been pushed onto a navigation controller, return it. + +@end diff --git a/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.m b/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.m new file mode 100644 index 0000000..bb6605d --- /dev/null +++ b/ViewDeckExample/vendor/ViewDeck/IIViewDeckController.m @@ -0,0 +1,227 @@ +// +// IIViewDeckController.m +// ViewDeckExample +// +// Created by Tom Adriaenssen on 03/12/11. +// Copyright (c) 2011 Adriaenssen BVBA. All rights reserved. +// + +#import "IIViewDeckController.h" +#import +#import + +@interface IIViewDeckController () { +} + +@property (nonatomic, retain) UIViewController* centerController; +@property (nonatomic, retain) UIViewController* leftController; +@property (nonatomic, retain) UIViewController* rightController; +//@property (nonatomic, retain) UIViewController* topController; +//@property (nonatomic, retain) UIViewController* bottomController; + +@end + +@interface UIViewController (Stuff_Internal) + +- (void)setViewDeckController:(IIViewDeckController*)viewDeckController; + +@end + +@implementation IIViewDeckController + +@synthesize centerController = _centerController; +@synthesize leftController = _leftController; +@synthesize rightController = _rightController; + +#pragma mark - Initalisation and deallocation + +- (id)initWithCenterViewController:(UIViewController*)centerController { + if ((self = [self init])) { + self.centerController = centerController; + [self.centerController setViewDeckController:self]; + self.leftController = nil; + self.rightController = nil; + } + return self; +} + +- (id)initWithCenterViewController:(UIViewController*)centerController leftViewController:(UIViewController*)leftController { + if ((self = [self initWithCenterViewController:centerController])) { + self.leftController = leftController; + [self.leftController setViewDeckController:self]; + } + return self; +} + +- (id)initWithCenterViewController:(UIViewController*)centerController leftViewController:(UIViewController*)leftController rightViewController:(UIViewController*)rightController { + if ((self = [self initWithCenterViewController:centerController])) { + self.leftController = leftController; + [self.leftController setViewDeckController:self]; + + self.rightController = rightController; + [self.rightController setViewDeckController:self]; + } + return self; +} + +- (void)dealloc { + self.centerController.viewDeckController = nil; + self.leftController.viewDeckController = nil; + self.rightController.viewDeckController = nil; +} + +#pragma mark - Memory management + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + + [self.centerController didReceiveMemoryWarning]; + [self.leftController didReceiveMemoryWarning]; + [self.rightController didReceiveMemoryWarning]; +} + +#pragma mark - View lifecycle + +// Implement loadView to create a view hierarchy programmatically, without using a nib. +- (void)loadView +{ + self.view = [[UIView alloc] init]; + + [self.view addSubview:self.leftController.view]; + [self.view addSubview:self.rightController.view]; + [self.view addSubview:self.centerController.view]; +} + +- (void)viewDidUnload +{ + [super viewDidUnload]; + + [self.centerController.view removeFromSuperview]; + [self.leftController.view removeFromSuperview]; + [self.rightController.view removeFromSuperview]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + self.centerController.view.frame = self.view.bounds; + self.centerController.view.hidden = NO; + self.leftController.view.frame = self.view.bounds; + self.leftController.view.hidden = YES; + self.rightController.view.frame = self.view.bounds; + self.rightController.view.hidden = YES; + + self.centerController.view.layer.shadowRadius = 10; + self.centerController.view.layer.shadowOpacity = 0.5; + self.centerController.view.layer.shadowColor = [[UIColor blackColor] CGColor]; + self.centerController.view.layer.shadowOffset = CGSizeZero; + self.centerController.view.layer.shadowPath = [[UIBezierPath bezierPathWithRect:self.view.bounds] CGPath]; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return [self.centerController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + // todo check slidden out controller +} + +#define SLIDE_DURATION(animated) ((animated) ? 0.3 : 0) + +- (void)toggleLeftView { + [self toggleLeftViewAnimated:YES]; +} + +- (void)openLeftView { + [self openLeftViewAnimated:YES]; +} + +- (void)closeLeftView { + [self closeLeftViewAnimated:YES]; +} + +- (void)toggleLeftViewAnimated:(BOOL)animated { + NSLog(@"left(%@).view.hidden = %d", self.leftController, self.leftController.view.hidden); + if (self.leftController.view.hidden) + [self openLeftViewAnimated:animated]; + else + [self closeLeftViewAnimated:animated]; +} + +- (void)openLeftViewAnimated:(BOOL)animated { + [UIView animateWithDuration:SLIDE_DURATION(animated) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + int leftMargin = 44; + self.leftController.view.hidden = NO; + self.centerController.view.frame = (CGRect) { self.view.bounds.size.width - leftMargin, 0, self.view.bounds.size }; + } completion:^(BOOL finished) { + }]; +} + +- (void)closeLeftViewAnimated:(BOOL)animated { + [UIView animateWithDuration:SLIDE_DURATION(animated) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.centerController.view.frame = self.view.bounds; + } completion:^(BOOL finished) { + self.leftController.view.hidden = YES; + }]; +} + +- (void)toggleRightView { + [self toggleRightViewAnimated:YES]; +} + +- (void)openRightView { + [self openRightViewAnimated:YES]; +} + +- (void)closeRightView { + [self closeRightViewAnimated:YES]; +} + +- (void)toggleRightViewAnimated:(BOOL)animated { + if (self.rightController.view.hidden) + [self openRightViewAnimated:animated]; + else + [self closeRightViewAnimated:animated]; +} + +- (void)openRightViewAnimated:(BOOL)animated { + [UIView animateWithDuration:SLIDE_DURATION(animated) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + int rightMargin = 44; + self.rightController.view.hidden = NO; + self.centerController.view.frame = (CGRect) { rightMargin - self.view.bounds.size.width, 0, self.view.bounds.size }; + } completion:^(BOOL finished) { + }]; +} + +- (void)closeRightViewAnimated:(BOOL)animated { + [UIView animateWithDuration:SLIDE_DURATION(animated) delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + self.centerController.view.frame = self.view.bounds; + } completion:^(BOOL finished) { + self.rightController.view.hidden = YES; + }]; +} + +@end + + +@implementation UIViewController (Stuff) + +@dynamic viewDeckController; + +static char* viewDeckControllerKey = "ViewDeckController"; + +- (IIViewDeckController*)viewDeckController { + id result = objc_getAssociatedObject(self, viewDeckControllerKey); + if (!result && self.navigationController) + return [self.navigationController viewDeckController]; + + NSLog(@"Getting view deck controller %@ from object %@ (key = %p)", result, self, viewDeckControllerKey); + return result; +} + +- (void)setViewDeckController:(IIViewDeckController*)viewDeckController { + NSLog(@"Setting view deck controller %@ on object %@ (key = %p)", viewDeckController, self, viewDeckControllerKey); + objc_setAssociatedObject(self, viewDeckControllerKey, viewDeckController, OBJC_ASSOCIATION_RETAIN); +} + +@end +