-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD: First version of conductor with simple navigation
- Loading branch information
Showing
22 changed files
with
696 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// AViewController.h | ||
// Conductor | ||
// | ||
// Created by Draco Yam on 7/8/14. | ||
// | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// AViewController.m | ||
// Conductor | ||
// | ||
// Created by Draco Yam on 7/8/14. | ||
// | ||
// | ||
|
||
#import "AViewController.h" | ||
|
||
#import "BViewController.h" | ||
|
||
#import "AppDelegate.h" | ||
|
||
#import "SegueToLeft.h" | ||
|
||
#import "BViewController.h" | ||
|
||
@interface AViewController () | ||
|
||
@end | ||
|
||
@implementation AViewController | ||
|
||
- (void) loadView { | ||
self.view = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds]; | ||
self.view.backgroundColor = [UIColor redColor]; | ||
|
||
[self performSelector:@selector(switchToSecond) withObject:nil afterDelay:3.0]; | ||
} | ||
|
||
- (void) switchToSecond { | ||
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; | ||
NSLog(@"Stack Count Before, %d", [appDelegate.conductor.ctrStack count]); | ||
[appDelegate.conductor addCtr:[[BViewController alloc]init] withKey:@"bControl" withSegue:[[SegueToLeft alloc]init]]; | ||
NSLog(@"Stack Count After, %d", [appDelegate.conductor.ctrStack count]); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// BViewController.h | ||
// Conductor | ||
// | ||
// Created by Draco Yam on 7/8/14. | ||
// | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface BViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// BViewController.m | ||
// Conductor | ||
// | ||
// Created by Draco Yam on 7/8/14. | ||
// | ||
// | ||
|
||
#import "BViewController.h" | ||
|
||
#import "AppDelegate.h" | ||
|
||
#import "SegueToRight.h" | ||
|
||
@interface BViewController () | ||
|
||
@end | ||
|
||
@implementation BViewController | ||
|
||
- (void) loadView { | ||
self.view = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds]; | ||
self.view.backgroundColor = [UIColor blueColor]; | ||
|
||
[self performSelector:@selector(pop) withObject:nil afterDelay:3.0]; | ||
} | ||
|
||
- (void) pop { | ||
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; | ||
NSLog(@"Stack Count Before, %d", [appDelegate.conductor.ctrStack count]); | ||
[appDelegate.conductor popCtrWithSegue:[[SegueToRight alloc]init]]; | ||
NSLog(@"Stack Count After, %d", [appDelegate.conductor.ctrStack count]); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// Conductor.h | ||
// cube | ||
// | ||
// Created by Draco on 5/7/14. | ||
// Copyright (c) 2014 Draco. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
// Segue | ||
#import "ConductorSegue.h" | ||
|
||
@interface Conductor : NSObject | ||
|
||
@property (nonatomic, strong) UIViewController *rootCtr; | ||
@property (nonatomic, strong) NSMutableArray *ctrStack; | ||
|
||
#pragma mark - | ||
#pragma mark Stack controls | ||
/** | ||
* Push viewController to the stack | ||
* @param vctr, viewController to push to stack | ||
*/ | ||
- (void) push:(UIViewController*)vctr; | ||
|
||
|
||
/** | ||
* Push viewController to the stack and append a key with it so that you can remove together | ||
* @param vctr, viewController to push to stack | ||
* @param key, key to recognize each controller or a collection of controller | ||
*/ | ||
- (void) push:(UIViewController*)vctr withKey:(NSString*)key; | ||
|
||
|
||
/** | ||
* Pop the last controller from the stack and remove from stack | ||
* @return last viewController from stack | ||
*/ | ||
- (UIViewController*) pop; | ||
|
||
|
||
/** | ||
* Get the last controller from the stack without remove from stack | ||
* @return last viewController from stack | ||
*/ | ||
- (UIViewController*) last; | ||
|
||
#pragma mark - | ||
#pragma mark Transitions | ||
/** | ||
* Add Ctr to stack and perform animation with segue (key is tagged as @"") | ||
* @param ctr, viewController to add to manager | ||
* @param segue, defining transition | ||
*/ | ||
- (void) addCtr:(UIViewController*)ctr withSegue:(ConductorSegue*)segue; | ||
|
||
|
||
/** | ||
* Add Ctr to stack and perform animation with segue (key of controller is also tag) | ||
* @param ctr, viewController to add to manager | ||
* @param key, the key to tag the controller | ||
* @param segue, defining transition | ||
*/ | ||
- (void) addCtr:(UIViewController*)ctr withKey:(NSString*)key withSegue:(ConductorSegue*)segue; | ||
|
||
|
||
/** | ||
* Return to last controller | ||
* @param segue, defining transition | ||
*/ | ||
- (void) popCtrWithSegue:(ConductorSegue*)segue; | ||
|
||
@end |
Oops, something went wrong.