Skip to content

Commit

Permalink
ADD: Drop down and move up segue
Browse files Browse the repository at this point in the history
  • Loading branch information
yamdraco committed Aug 12, 2014
1 parent db21c31 commit c7bad6d
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 3 deletions.
4 changes: 3 additions & 1 deletion AViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#import "AppDelegate.h"

#import "SegueToLeft.h"
#import "SegueToDrop.h"
#import "SegueToTop.h"

#import "BViewController.h"

Expand All @@ -32,7 +34,7 @@ - (void) loadView {
- (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]];
[appDelegate.conductor addCtr:[[BViewController alloc]init] withKey:@"bControl" withSegue:[[SegueToTop alloc]init]];
NSLog(@"Stack Count After, %d", [appDelegate.conductor.ctrStack count]);
}

Expand Down
12 changes: 12 additions & 0 deletions Conductor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
C00D92EF1999C0FA0024D238 /* SegueToTop.m in Sources */ = {isa = PBXBuildFile; fileRef = C00D92EE1999C0FA0024D238 /* SegueToTop.m */; };
C00D92F21999C10E0024D238 /* SegueToDrop.m in Sources */ = {isa = PBXBuildFile; fileRef = C00D92F11999C10E0024D238 /* SegueToDrop.m */; };
C0B8593D196BB414005EB028 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0B8593C196BB414005EB028 /* Foundation.framework */; };
C0B8593F196BB414005EB028 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0B8593E196BB414005EB028 /* CoreGraphics.framework */; };
C0B85941196BB414005EB028 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0B85940196BB414005EB028 /* UIKit.framework */; };
Expand Down Expand Up @@ -46,6 +48,10 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
C00D92ED1999C0FA0024D238 /* SegueToTop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegueToTop.h; sourceTree = "<group>"; };
C00D92EE1999C0FA0024D238 /* SegueToTop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SegueToTop.m; sourceTree = "<group>"; };
C00D92F01999C10E0024D238 /* SegueToDrop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegueToDrop.h; sourceTree = "<group>"; };
C00D92F11999C10E0024D238 /* SegueToDrop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SegueToDrop.m; sourceTree = "<group>"; };
C0B85939196BB414005EB028 /* Conductor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Conductor.app; sourceTree = BUILT_PRODUCTS_DIR; };
C0B8593C196BB414005EB028 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
C0B8593E196BB414005EB028 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -209,6 +215,10 @@
C0B85995196BEAC1005EB028 /* SegueToLeft.m */,
C0B85996196BEAC1005EB028 /* SegueToRight.h */,
C0B85997196BEAC1005EB028 /* SegueToRight.m */,
C00D92ED1999C0FA0024D238 /* SegueToTop.h */,
C00D92EE1999C0FA0024D238 /* SegueToTop.m */,
C00D92F01999C10E0024D238 /* SegueToDrop.h */,
C00D92F11999C10E0024D238 /* SegueToDrop.m */,
);
path = segue;
sourceTree = "<group>";
Expand Down Expand Up @@ -309,7 +319,9 @@
files = (
C0B8594D196BB414005EB028 /* AppDelegate.m in Sources */,
C0B8599A196BEAC1005EB028 /* SegueToRight.m in Sources */,
C00D92EF1999C0FA0024D238 /* SegueToTop.m in Sources */,
C0B85989196BCF24005EB028 /* RootController.m in Sources */,
C00D92F21999C10E0024D238 /* SegueToDrop.m in Sources */,
C0B85978196BCBDA005EB028 /* ConductorSegue.m in Sources */,
C0B85991196BCF9E005EB028 /* BViewController.m in Sources */,
C0B8598D196BCF95005EB028 /* AViewController.m in Sources */,
Expand Down
13 changes: 13 additions & 0 deletions Conductor/lib/segue/SegueToDrop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// SegueToBottom.h
// Conductor
//
// Created by Draco Yam on 8/12/14.
//
//

#import "ConductorSegue.h"

@interface SegueToDrop : ConductorSegue

@end
46 changes: 46 additions & 0 deletions Conductor/lib/segue/SegueToDrop.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// SegueToBottom.m
// Conductor
//
// Created by Draco Yam on 8/12/14.
//
//

#import "SegueToDrop.h"

@implementation SegueToDrop

- (void) perform {
[self prePerform];

// Layout subview layers
[self.root.view bringSubviewToFront:self.fromCtr.view];

// Add to root.view if not added
if (!self.toCtr.view.superview) {
[self.root.view addSubview:self.toCtr.view];
}

// Set view position for both to and from controller.view
self.fromCtr.view.frame = CGRectMake(0, 0, self.fromCtr.view.frame.size.width, self.fromCtr.view.frame.size.height);
self.toCtr.view.frame = CGRectMake(0, -self.toCtr.view.frame.size.height, self.toCtr.view.frame.size.width, self.toCtr.view.frame.size.height);

// Set both to be unhidden
self.fromCtr.view.alpha = 1;
self.toCtr.view.alpha = 1;

[UIView animateWithDuration: 0.3
delay: 0.0
options: self.animationOpt
animations:^{
self.fromCtr.view.frame = CGRectMake(0, 0, self.fromCtr.view.frame.size.width, self.fromCtr.view.frame.size.height);
self.toCtr.view.frame = CGRectMake(0, 0, self.toCtr.view.frame.size.width, self.toCtr.view.frame.size.height);
}
completion:^(BOOL finsihed){
[self postPerform];
}];

[self postPerform];
}

@end
13 changes: 13 additions & 0 deletions Conductor/lib/segue/SegueToTop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// SegueToTop.h
// Conductor
//
// Created by Draco Yam on 8/12/14.
//
//

#import "ConductorSegue.h"

@interface SegueToTop : ConductorSegue

@end
47 changes: 47 additions & 0 deletions Conductor/lib/segue/SegueToTop.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// SegueToTop.m
// Conductor
//
// Created by Draco Yam on 8/12/14.
//
//

#import "SegueToTop.h"

@implementation SegueToTop

- (void) perform {
[self prePerform];

// Layout subview layers
[self.root.view bringSubviewToFront:self.fromCtr.view];

// Add to root.view if not added
[self.toCtr.view removeFromSuperview];
if (!self.toCtr.view.superview) {
[self.root.view insertSubview:self.toCtr.view belowSubview:self.fromCtr.view];
}

// Set view position for both to and from controller.view
self.fromCtr.view.frame = CGRectMake(0, 0, self.fromCtr.view.frame.size.width, self.fromCtr.view.frame.size.height);
self.toCtr.view.frame = CGRectMake(0, 0, self.toCtr.view.frame.size.width, self.toCtr.view.frame.size.height);

// Set both to be unhidden
self.fromCtr.view.alpha = 1;
self.toCtr.view.alpha = 1;

[UIView animateWithDuration: 0.3
delay: 0.0
options: self.animationOpt
animations:^{
self.fromCtr.view.frame = CGRectMake(0, -self.fromCtr.view.frame.size.height, self.fromCtr.view.frame.size.width, self.fromCtr.view.frame.size.height);
self.toCtr.view.frame = CGRectMake(0, 0, self.toCtr.view.frame.size.width, self.toCtr.view.frame.size.height);
}
completion:^(BOOL finsihed){
[self postPerform];
}];

[self postPerform];
}

@end
4 changes: 2 additions & 2 deletions conductor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Pod::Spec.new do |s|
#

s.name = "conductor"
s.version = "0.0.1"
s.version = "0.1.0"
s.summary = "Conductor for managing uiviewcontrollers instead of using story board"

s.homepage = "https://github.com/yamdraco/conductor"
s.license = { :type => "MIT" }
s.author = { "Draco Yam" => "[email protected]" }
s.platform = :ios, "6.0"
s.source = { :git => "https://github.com/yamdraco/conductor.git", :tag => "0.0.1" }
s.source = { :git => "https://github.com/yamdraco/conductor.git", :tag => "0.1.0" }

s.source_files = "Conductor/lib/*.{h,m}", "Conductor/lib/segue/*.{h,m}"
s.requires_arc = true
Expand Down

0 comments on commit c7bad6d

Please sign in to comment.