Skip to content

Commit

Permalink
Merge branch 'navigationcontroller'
Browse files Browse the repository at this point in the history
  • Loading branch information
honcheng committed Aug 11, 2012
2 parents 9f87c89 + cddf12b commit 52069fa
Show file tree
Hide file tree
Showing 16 changed files with 818 additions and 0 deletions.

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions PaperFold-ContainmentView/PaperFold-ContainmentView/AppDelegate.h
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
69 changes: 69 additions & 0 deletions PaperFold-ContainmentView/PaperFold-ContainmentView/AppDelegate.m
@@ -0,0 +1,69 @@
//
// AppDelegate.m
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import "AppDelegate.h"
#import "PaperFoldNavigationController.h"
#import "ContentViewController.h"
#import "LeftViewController.h"
#import "RightViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

ContentViewController *contentViewController = [[ContentViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:contentViewController];
PaperFoldNavigationController *paperFoldNavController = [[PaperFoldNavigationController alloc] initWithRootViewController:navController];
[self.window setRootViewController:paperFoldNavController];

LeftViewController *leftViewController = [[LeftViewController alloc] init];
UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftViewController];
[leftNavController setNavigationBarHidden:YES];
[paperFoldNavController setLeftViewController:leftNavController width:150];

RightViewController *rightViewController = [[RightViewController alloc] init];
UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightViewController];
[rightNavController setNavigationBarHidden:YES];
[paperFoldNavController setRightViewController:rightNavController width:250.0 rightViewFoldCount:3 rightViewPullFactor:0.9];

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
@@ -0,0 +1,13 @@
//
// ContentViewController.h
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ContentViewController : UITableViewController

@end
@@ -0,0 +1,55 @@
//
// ContentViewController.m
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import "ContentViewController.h"

@interface ContentViewController ()

@end

@implementation ContentViewController

- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewController *viewController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:viewController animated:YES];
}

@end
@@ -0,0 +1,13 @@
//
// LeftViewController.h
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface LeftViewController : UITableViewController

@end
@@ -0,0 +1,55 @@
//
// LeftViewController.m
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import "LeftViewController.h"

@interface LeftViewController ()

@end

@implementation LeftViewController

- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewController *viewController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:viewController animated:YES];
}

@end
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.honcheng.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'PaperFold-ContainmentView' target in the 'PaperFold-ContainmentView' project
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
@@ -0,0 +1,13 @@
//
// RightViewController.h
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface RightViewController : UITableViewController

@end
@@ -0,0 +1,64 @@
//
// RightViewController.m
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import "RightViewController.h"

@interface RightViewController ()

@end

@implementation RightViewController

- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}

- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"right view will appear");
}

- (void)viewDidAppear:(BOOL)animated
{
NSLog(@"right view did appear");
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewController *viewController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:viewController animated:YES];
}

@end
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

18 changes: 18 additions & 0 deletions PaperFold-ContainmentView/PaperFold-ContainmentView/main.m
@@ -0,0 +1,18 @@
//
// main.m
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
18 changes: 18 additions & 0 deletions PaperFold/PaperFold/PaperFold/PaperFoldNavigationController.h
@@ -0,0 +1,18 @@
//
// PaperFoldNavigationController.h
// PaperFold-ContainmentView
//
// Created by honcheng on 10/8/12.
// Copyright (c) 2012 honcheng. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "PaperFoldView.h"

@interface PaperFoldNavigationController : UIViewController <PaperFoldViewDelegate>
@property (nonatomic, strong) UIViewController *rootViewController, *leftViewController, *rightViewController;
@property (nonatomic, strong) PaperFoldView *paperFoldView;
- (id)initWithRootViewController:(UIViewController*)rootViewController;
- (void)setLeftViewController:(UIViewController *)leftViewController width:(float)width;
- (void)setRightViewController:(UIViewController*)rightViewController width:(float)width rightViewFoldCount:(int)rightViewFoldCount rightViewPullFactor:(float)rightViewPullFactor;
@end

0 comments on commit 52069fa

Please sign in to comment.