From 12cd5e7cf6107d28940307829d9cbd9ae6446d69 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Tue, 14 Feb 2012 11:56:05 -0700 Subject: [PATCH 01/14] Change to give PSStackedViewController the ability to pop off all view controllers but the first when the user drags the entire stack to the right --- PSStackedView/PSStackedViewController.h | 6 +++++- PSStackedView/PSStackedViewController.m | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/PSStackedView/PSStackedViewController.h b/PSStackedView/PSStackedViewController.h index 40d5756..67c141b 100644 --- a/PSStackedView/PSStackedViewController.h +++ b/PSStackedView/PSStackedViewController.h @@ -14,7 +14,8 @@ enum { SVSnapOptionNearest, SVSnapOptionLeft, - SVSnapOptionRight + SVSnapOptionRight, + SVSnapOptionPopRight } typedef PSSVSnapOption; /// StackController hosing a backside rootViewController and the stacked controllers @@ -111,6 +112,9 @@ enum { /// Property to disable bounces @property(nonatomic, assign) BOOL enableBounces; +/// Property to enable poping off all of the stack views except the first when dragged past a specified amount +@property(nonatomic, assign) BOOL enablePopOffOnDragRight; + /// left inset thats always visible. Defaults to 60. @property(nonatomic, assign) NSUInteger leftInset; /// animate setting of the left inset that is always visible diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index e9aba1d..69534d8 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -60,6 +60,7 @@ @implementation PSStackedViewController @synthesize delegate = delegate_; @synthesize reduceAnimations = reduceAnimations_; @synthesize enableBounces = enableBounces_; +@synthesize enablePopOffOnDragRight = enablePopOffOnDragRight_; @dynamic firstVisibleIndex; #ifdef ALLOW_SWIZZLING_NAVIGATIONCONTROLLER @@ -792,6 +793,15 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { lastDragOffset_ = translatedPoint.x; } + if(self.enablePopOffOnDragRight) { + if(self.floatIndex == 0.0 && lastDragOffset_ > 350) { + lastDragOption_ = SVSnapOptionPopRight; + } + else if(lastDragOption_ == SVSnapOptionPopRight) { + lastDragOption_ = SVSnapOptionNearest; + } + } + // perform snapping after gesture ended BOOL gestureEnded = state == UIGestureRecognizerStateEnded; if (gestureEnded) { @@ -800,7 +810,11 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { self.floatIndex = [self nearestValidFloatIndex:self.floatIndex round:PSSVRoundDown]; }else if(lastDragOption_ == SVSnapOptionLeft) { self.floatIndex = [self nearestValidFloatIndex:self.floatIndex round:PSSVRoundUp]; - }else { + }else if(lastDragOption_ == SVSnapOptionPopRight) { + self.floatIndex = 0.0; + [self popToViewController:[self.viewControllers objectAtIndex:0] animated:YES]; + } + else { self.floatIndex = [self nearestValidFloatIndex:self.floatIndex round:PSSVRoundNearest]; } From ba33761ceb04672c686ed239bc440bf48f316b6d Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Tue, 14 Feb 2012 12:04:51 -0700 Subject: [PATCH 02/14] Added property to control the action taken when poping off view controllers by dragging to the right (pop all, all but first, or top) --- PSStackedView/PSStackedViewController.h | 9 +++++++++ PSStackedView/PSStackedViewController.m | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/PSStackedView/PSStackedViewController.h b/PSStackedView/PSStackedViewController.h index 67c141b..91f7603 100644 --- a/PSStackedView/PSStackedViewController.h +++ b/PSStackedView/PSStackedViewController.h @@ -18,6 +18,12 @@ enum { SVSnapOptionPopRight } typedef PSSVSnapOption; +enum { + SVPopOptionAllButFirst, + SVPopOptionAll, + SVPopOptionTop +} typedef PSSVPopOption; + /// StackController hosing a backside rootViewController and the stacked controllers @interface PSStackedViewController : UIViewController @@ -115,6 +121,9 @@ enum { /// Property to enable poping off all of the stack views except the first when dragged past a specified amount @property(nonatomic, assign) BOOL enablePopOffOnDragRight; +/// Property to determine the type of pop off action that will be taken when entire stack is dragged to the right +@property(nonatomic, assign) PSSVPopOption popOffType; + /// left inset thats always visible. Defaults to 60. @property(nonatomic, assign) NSUInteger leftInset; /// animate setting of the left inset that is always visible diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index 69534d8..b924898 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -61,6 +61,7 @@ @implementation PSStackedViewController @synthesize reduceAnimations = reduceAnimations_; @synthesize enableBounces = enableBounces_; @synthesize enablePopOffOnDragRight = enablePopOffOnDragRight_; +@synthesize popOffType = popOffType_; @dynamic firstVisibleIndex; #ifdef ALLOW_SWIZZLING_NAVIGATIONCONTROLLER @@ -812,7 +813,18 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { self.floatIndex = [self nearestValidFloatIndex:self.floatIndex round:PSSVRoundUp]; }else if(lastDragOption_ == SVSnapOptionPopRight) { self.floatIndex = 0.0; - [self popToViewController:[self.viewControllers objectAtIndex:0] animated:YES]; + if(self.popOffType == SVPopOptionAll) { + [self popToRootViewControllerAnimated:YES]; + } + else if(self.popOffType == SVPopOptionAllButFirst) { + [self popToViewController:[self.viewControllers objectAtIndex:0] animated:YES]; + } + else if(self.popOffType == SVPopOptionTop) { + if([self.viewControllers count] == 1) + [self popToRootViewControllerAnimated:YES]; + else + [self popToViewController:[self.viewControllers objectAtIndex:[self.viewControllers count]-2] animated:YES]; + } } else { self.floatIndex = [self nearestValidFloatIndex:self.floatIndex round:PSSVRoundNearest]; From d97cfcbbd4eb995eee83ebbc0898340cbf83af6e Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Tue, 14 Feb 2012 12:15:28 -0700 Subject: [PATCH 03/14] Make a constant to use for the distance the user needs to drag to the right to get view controllers to pop off instead of a magic number --- PSStackedView/PSStackedViewController.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index b924898..d8dd24b 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -18,6 +18,7 @@ #define kPSSVStackAnimationPopDuration kPSSVStackAnimationSpeedModifier * 0.25f #define kPSSVMaxSnapOverOffset 20 #define kPSSVAssociatedBaseViewControllerKey @"kPSSVAssociatedBaseViewController" +#define kPSSVPopOffDistance 350 // reduces alpha over overlapped view controllers. 1.f would totally black-out on complete overlay #define kAlphaReductRatio 10.f @@ -795,7 +796,7 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { } if(self.enablePopOffOnDragRight) { - if(self.floatIndex == 0.0 && lastDragOffset_ > 350) { + if(self.floatIndex == 0.0 && lastDragOffset_ > kPSSVPopOffDistance) { lastDragOption_ = SVSnapOptionPopRight; } else if(lastDragOption_ == SVSnapOptionPopRight) { From 8b68e7e2e14ef247e8a47ba0326642d049e35215 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Tue, 14 Feb 2012 22:32:24 -0700 Subject: [PATCH 04/14] Update the delegate to have four new methods called to when the user is dragging stackedViewDidStartDragging: - Called when user starts dragging the stack stackedViewDidStopDragging: - Called when user stops dragging the stack stackedViewWillPopViewControllers: - Called when the user has dragged the entire stack far enough right that it will trigger the pop off when released (enablePopOffOnDragRight must be set to YES) stackedViewWillNotPopViewControllers: - Called if the user returns the stack far enough left so that it will no longer trigger the pop off when released (enablePopOffOnDragRight must be set to YES) --- PSStackedView/PSStackedViewController.m | 27 +++++++++++++++++++++++-- PSStackedView/PSStackedViewDelegate.h | 12 +++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index d8dd24b..d90485f 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -40,7 +40,11 @@ @interface PSStackedViewController() { unsigned int delegateWillInsertViewController:1; unsigned int delegateDidInsertViewController:1; unsigned int delegateWillRemoveViewController:1; - unsigned int delegateDidRemoveViewController:1; + unsigned int delegateDidRemoveViewController:1; + unsigned int delegateDidStartDragging:1; + unsigned int delegateDidStopDragging:1; + unsigned int delegateWillPopViewControllers:1; + unsigned int delegateWillNotPopViewControllers:1; }delegateFlags_; } @property(nonatomic, strong) UIViewController *rootViewController; @@ -126,6 +130,10 @@ - (void)setDelegate:(id)delegate { delegateFlags_.delegateDidInsertViewController = [delegate respondsToSelector:@selector(stackedView:didInsertViewController:)]; delegateFlags_.delegateWillRemoveViewController = [delegate respondsToSelector:@selector(stackedView:willRemoveViewController:)]; delegateFlags_.delegateDidRemoveViewController = [delegate respondsToSelector:@selector(stackedView:didRemoveViewController:)]; + delegateFlags_.delegateDidStartDragging = [delegate respondsToSelector:@selector(stackedViewDidStartDragging:)]; + delegateFlags_.delegateDidStopDragging = [delegate respondsToSelector:@selector(stackedViewDidStopDragging:)]; + delegateFlags_.delegateWillPopViewControllers = [delegate respondsToSelector:@selector(stackedViewWillPopViewControllers:)]; + delegateFlags_.delegateWillNotPopViewControllers = [delegate respondsToSelector:@selector(stackedViewWillNotPopViewControllers:)]; } } @@ -778,6 +786,9 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { // set up designated drag destination if (state == UIGestureRecognizerStateBegan) { + if (delegateFlags_.delegateDidStartDragging) { + [delegate_ stackedViewDidStartDragging:self]; + } if (offset > 0) { lastDragOption_ = SVSnapOptionRight; }else { @@ -797,10 +808,18 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { if(self.enablePopOffOnDragRight) { if(self.floatIndex == 0.0 && lastDragOffset_ > kPSSVPopOffDistance) { - lastDragOption_ = SVSnapOptionPopRight; + if(lastDragOption_ != SVSnapOptionPopRight) { + lastDragOption_ = SVSnapOptionPopRight; + if(delegateFlags_.delegateWillPopViewControllers) { + [delegate_ stackedViewWillPopViewControllers:self]; + } + } } else if(lastDragOption_ == SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionNearest; + if(delegateFlags_.delegateWillNotPopViewControllers) { + [delegate_ stackedViewWillNotPopViewControllers:self]; + } } } @@ -832,6 +851,10 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { } [self alignStackAnimated:YES]; + + if(delegateFlags_.delegateDidStopDragging) { + [delegate_ stackedViewDidStopDragging:self]; + } } } diff --git a/PSStackedView/PSStackedViewDelegate.h b/PSStackedView/PSStackedViewDelegate.h index 556e02d..9e3df7f 100644 --- a/PSStackedView/PSStackedViewDelegate.h +++ b/PSStackedView/PSStackedViewDelegate.h @@ -26,4 +26,16 @@ /// viewController has been removed - (void)stackedView:(PSStackedViewController *)stackedView didRemoveViewController:(UIViewController *)viewController; +/// stackcontroller will pop off view controllers because of drag to right +- (void)stackedViewWillPopViewControllers:(PSStackedViewController *)stackedView; + +/// stackcontroller will no longer pop off view controllers because of drag to right +- (void)stackedViewWillNotPopViewControllers:(PSStackedViewController *)stackedView; + +/// stackcontroller did start dragging stack +- (void)stackedViewDidStartDragging:(PSStackedViewController*)stackedView; + +/// stackcontroller did stop dragging stack +- (void)stackedViewDidStopDragging:(PSStackedViewController*)stackedView; + @end From d044a06cf4c4f6d9163aa791b554bafff79774e7 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Tue, 14 Feb 2012 22:35:29 -0700 Subject: [PATCH 05/14] Update the example to use the new pop view controller when dragged right feature. The example now uses the "pop view controller when dragged to the right" feature; it also handles the delegate methods to provide visual feedback to the user similar to the twitter app. The example uses the SVPopOptionAllButFirst type (functions the same as twitter); this can be changed by changing the value of the popOffType property of the stack controller instance. --- .../project.pbxproj | 4 ++ Example/StackedViewKitExample/AppDelegate.m | 3 ++ .../ExampleMenuRootController.h | 4 +- .../ExampleMenuRootController.m | 46 ++++++++++++++++++ .../StackedViewKitExample/Images/popIcon.png | Bin 0 -> 875 bytes 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 Example/StackedViewKitExample/Images/popIcon.png diff --git a/Example/PSStackedViewExample.xcodeproj/project.pbxproj b/Example/PSStackedViewExample.xcodeproj/project.pbxproj index e59b73c..18a9d08 100644 --- a/Example/PSStackedViewExample.xcodeproj/project.pbxproj +++ b/Example/PSStackedViewExample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1F82478114EB76AD00773D9B /* popIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1F82478014EB76AD00773D9B /* popIcon.png */; }; 1FEE7FF814C8E23200424F88 /* PSStackedViewSegue.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FEE7FF714C8E23200424F88 /* PSStackedViewSegue.m */; }; 3798AD7B13E0B299004C1E33 /* error.png in Resources */ = {isa = PBXBuildFile; fileRef = 3798AD7413E0B299004C1E33 /* error.png */; }; 3798AD7D13E0B299004C1E33 /* error@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3798AD7613E0B299004C1E33 /* error@2x.png */; }; @@ -39,6 +40,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1F82478014EB76AD00773D9B /* popIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popIcon.png; sourceTree = ""; }; 1FEE7FF614C8E23200424F88 /* PSStackedViewSegue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSStackedViewSegue.h; path = ../../PSStackedView/PSStackedViewSegue.h; sourceTree = ""; }; 1FEE7FF714C8E23200424F88 /* PSStackedViewSegue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PSStackedViewSegue.m; path = ../../PSStackedView/PSStackedViewSegue.m; sourceTree = ""; }; 3798AD7413E0B299004C1E33 /* error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = error.png; sourceTree = ""; }; @@ -209,6 +211,7 @@ 7884393E13CEF82D00D18A56 /* Images */ = { isa = PBXGroup; children = ( + 1F82478014EB76AD00773D9B /* popIcon.png */, 3798AD7313E0B299004C1E33 /* error */, 3798AD7713E0B299004C1E33 /* NewGlow */, 78BA6A1313CF05C200DDA16E /* 08-chat.png */, @@ -283,6 +286,7 @@ 3798AD7D13E0B299004C1E33 /* error@2x.png in Resources */, 3798AD7E13E0B299004C1E33 /* NewGlow.png in Resources */, 3798AD8013E0B299004C1E33 /* NewGlow@2x.png in Resources */, + 1F82478114EB76AD00773D9B /* popIcon.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/StackedViewKitExample/AppDelegate.m b/Example/StackedViewKitExample/AppDelegate.m index 62cefd9..5ff626e 100644 --- a/Example/StackedViewKitExample/AppDelegate.m +++ b/Example/StackedViewKitExample/AppDelegate.m @@ -26,6 +26,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // set root controller as stack controller ExampleMenuRootController *menuController = [[ExampleMenuRootController alloc] init]; self.stackController = [[PSStackedViewController alloc] initWithRootViewController:menuController]; + self.stackController.enablePopOffOnDragRight = YES; + self.stackController.popOffType = SVPopOptionAllButFirst; + self.stackController.delegate = menuController; self.window.rootViewController = self.stackController; [self.window makeKeyAndVisible]; diff --git a/Example/StackedViewKitExample/ExampleMenuRootController.h b/Example/StackedViewKitExample/ExampleMenuRootController.h index beb5095..46b37a1 100644 --- a/Example/StackedViewKitExample/ExampleMenuRootController.h +++ b/Example/StackedViewKitExample/ExampleMenuRootController.h @@ -8,8 +8,10 @@ #import -@interface ExampleMenuRootController : UIViewController { +@interface ExampleMenuRootController : UIViewController { UITableView *menuTable_; + UIImageView *popIconLeft_; + UIImageView *popIconRight_; NSArray *cellContents_; } diff --git a/Example/StackedViewKitExample/ExampleMenuRootController.m b/Example/StackedViewKitExample/ExampleMenuRootController.m index 4c4687c..f782aa8 100644 --- a/Example/StackedViewKitExample/ExampleMenuRootController.m +++ b/Example/StackedViewKitExample/ExampleMenuRootController.m @@ -23,12 +23,16 @@ @interface ExampleMenuRootController() @property (nonatomic, strong) UITableView *menuTable; @property (nonatomic, strong) NSArray *cellContents; +@property (nonatomic, strong) UIImageView *popIconLeft; +@property (nonatomic, strong) UIImageView *popIconRight; @end @implementation ExampleMenuRootController @synthesize menuTable = menuTable_; @synthesize cellContents = cellContents_; +@synthesize popIconLeft = popIconLeft_; +@synthesize popIconRight = popIconRight_; /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - NSObject @@ -69,6 +73,16 @@ - (void)viewDidLoad { self.menuTable.dataSource = self; [self.view addSubview:self.menuTable]; [self.menuTable reloadData]; + + self.popIconLeft = [[UIImageView alloc] initWithFrame:CGRectMake(225, 482, 50, 70)]; + self.popIconLeft.image = [UIImage imageNamed:@"popIcon.png"]; + self.popIconLeft.hidden = YES; + [self.view addSubview:self.popIconLeft]; + + self.popIconRight = [[UIImageView alloc] initWithFrame:CGRectMake(245, 502, 50, 70)]; + self.popIconRight.image = [UIImage imageNamed:@"popIcon.png"]; + self.popIconRight.hidden = YES; + [self.view addSubview:self.popIconRight]; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -145,4 +159,36 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } } +/// PSStackedViewDelegate methods + +- (void)stackedViewDidStartDragging:(PSStackedViewController *)stackedView { + if([stackedView.viewControllers count] > 0) { + self.popIconLeft.hidden = NO; + self.popIconRight.hidden = NO; + } +} + +- (void)stackedViewDidStopDragging:(PSStackedViewController *)stackedView { + self.popIconLeft.hidden = YES; + self.popIconRight.hidden = YES; + self.popIconRight.alpha = 1.0; + self.popIconRight.transform = CGAffineTransformIdentity; +} + +- (void)stackedViewWillPopViewControllers:(PSStackedViewController *)stackedView { + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconRight.alpha = 0.5; + CGAffineTransform trans = CGAffineTransformMakeTranslation(40, 10); + trans = CGAffineTransformRotate(trans, M_PI/4); + self.popIconRight.transform = trans; + }]; +} + +- (void)stackedViewWillNotPopViewControllers:(PSStackedViewController *)stackedView { + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconRight.alpha = 1.0; + self.popIconRight.transform = CGAffineTransformIdentity; + }]; +} + @end diff --git a/Example/StackedViewKitExample/Images/popIcon.png b/Example/StackedViewKitExample/Images/popIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..704f3c52466b179bd40f252cb80788d093786164 GIT binary patch literal 875 zcmeAS@N?(olHy`uVBq!ia0vp^MnLSw!3HGzdXA?7DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg49vWqE{-7;x8BT-&j<>XIlg|@%Cigkw!Dlo%~Uy@D)>6p zWo`Rjo^46ZD+F1jT>{TE9ZlHh!WyVkbED(ltpyjI1z0BP98^hGR^OW;lAYnCJ#kuB z@V1%XtSgs9$9`|0VJ*F%`TqU)<$J_`*1og+KIiub>qRko$8+1ZJ+1%$;Pja@yO>_^ zwmo%J@Z{VP7QmjNpJDG2v`FTDteow7beWjLgd^?_?GiIA=R4k2IKIk_ zMPXgTZpNT9=g;r&cTq}~U%veQu9$TzORWAb7MUrZowdqPs&}jPs@1cnrl$6OxLj;y zB;Mloe7+!K$L$AIo-*A>=iPk!E&AlnooA}}j;F5vx+ZS@dy(#=UN8EZ`MF0LL6e)Eo%&7n%94wMZtQee_^1P)kT3^}S|nTL%d&RknLIaJwH-{I6s8`j;c8Eh{4Wz36Eo-O^FQVt zT{994X53+z9~Sva)k#5mmm)`#0*Po1tH&&fxqj;DwwV(>LRR#}3NUdBC2x#a6~R8y zYiX<1+6@9H)+e2*{rc5CqU}XSzP-Xk53Lu?|Fu{?wMg{3T|QydaWlux^>E<9a+iFA zJq*t$pMF}p?O&aAx4_-l*t1?sKN++v5&7^gX!SMAPnT9-eKl>~ym@}tmQ6XCvde9^ z8Q14(Mga{?d){}7osU2Mm~r{#9(y~(jqB32*M0jI*K&2shlKZqKY#r=riY9ZYg?zxzTW5&6WMgc^W-~rz52YCDHDEo-QAHi n;i;6i`(&5dPdD7~XJlh2F8`@*AHn7e%smXAu6{1-oD!M Date: Tue, 14 Feb 2012 22:56:10 -0700 Subject: [PATCH 06/14] Changed the styling of the visual feedback in the example. --- .../ExampleMenuRootController.m | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Example/StackedViewKitExample/ExampleMenuRootController.m b/Example/StackedViewKitExample/ExampleMenuRootController.m index f782aa8..4b5862e 100644 --- a/Example/StackedViewKitExample/ExampleMenuRootController.m +++ b/Example/StackedViewKitExample/ExampleMenuRootController.m @@ -76,12 +76,12 @@ - (void)viewDidLoad { self.popIconLeft = [[UIImageView alloc] initWithFrame:CGRectMake(225, 482, 50, 70)]; self.popIconLeft.image = [UIImage imageNamed:@"popIcon.png"]; - self.popIconLeft.hidden = YES; + self.popIconLeft.alpha = 0.0; [self.view addSubview:self.popIconLeft]; self.popIconRight = [[UIImageView alloc] initWithFrame:CGRectMake(245, 502, 50, 70)]; self.popIconRight.image = [UIImage imageNamed:@"popIcon.png"]; - self.popIconRight.hidden = YES; + self.popIconRight.alpha = 0.0; [self.view addSubview:self.popIconRight]; } @@ -163,16 +163,19 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath - (void)stackedViewDidStartDragging:(PSStackedViewController *)stackedView { if([stackedView.viewControllers count] > 0) { - self.popIconLeft.hidden = NO; - self.popIconRight.hidden = NO; + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconLeft.alpha = 1.0; + self.popIconRight.alpha = 1.0; + }]; } } - (void)stackedViewDidStopDragging:(PSStackedViewController *)stackedView { - self.popIconLeft.hidden = YES; - self.popIconRight.hidden = YES; - self.popIconRight.alpha = 1.0; - self.popIconRight.transform = CGAffineTransformIdentity; + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconLeft.alpha = 0.0; + self.popIconRight.alpha = 0.0; + self.popIconRight.transform = CGAffineTransformIdentity; + }]; } - (void)stackedViewWillPopViewControllers:(PSStackedViewController *)stackedView { From f52a6d8a1b24c6aec63f9eaa969fd1dc062cde78 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 09:28:51 -0700 Subject: [PATCH 07/14] Changed the delegate methods for willPop and willNotPop to pass the viewControllers that will (or will no longer be) popped. --- PSStackedView/PSStackedViewController.m | 28 +++++++++++++++++++++---- PSStackedView/PSStackedViewDelegate.h | 4 ++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index d90485f..f7902c1 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -132,8 +132,8 @@ - (void)setDelegate:(id)delegate { delegateFlags_.delegateDidRemoveViewController = [delegate respondsToSelector:@selector(stackedView:didRemoveViewController:)]; delegateFlags_.delegateDidStartDragging = [delegate respondsToSelector:@selector(stackedViewDidStartDragging:)]; delegateFlags_.delegateDidStopDragging = [delegate respondsToSelector:@selector(stackedViewDidStopDragging:)]; - delegateFlags_.delegateWillPopViewControllers = [delegate respondsToSelector:@selector(stackedViewWillPopViewControllers:)]; - delegateFlags_.delegateWillNotPopViewControllers = [delegate respondsToSelector:@selector(stackedViewWillNotPopViewControllers:)]; + delegateFlags_.delegateWillPopViewControllers = [delegate respondsToSelector:@selector(stackedView:WillPopViewControllers:)]; + delegateFlags_.delegateWillNotPopViewControllers = [delegate respondsToSelector:@selector(stackedView:WillNotPopViewControllers:)]; } } @@ -811,14 +811,34 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { if(lastDragOption_ != SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionPopRight; if(delegateFlags_.delegateWillPopViewControllers) { - [delegate_ stackedViewWillPopViewControllers:self]; + NSArray* toPop; + if(self.popOffType == SVPopOptionAll) { + toPop = [self.viewControllers copy]; + } + else if(self.popOffType == SVPopOptionAllButFirst) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange(1, [self.viewControllers count] - 1)]; + } + else if(self.popOffType == SVPopOptionTop) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange([self.viewControllers count] - 1, 1)]; + } + [delegate_ stackedView:self WillPopViewControllers:toPop]; } } } else if(lastDragOption_ == SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionNearest; if(delegateFlags_.delegateWillNotPopViewControllers) { - [delegate_ stackedViewWillNotPopViewControllers:self]; + NSArray* toPop; + if(self.popOffType == SVPopOptionAll) { + toPop = [self.viewControllers copy]; + } + else if(self.popOffType == SVPopOptionAllButFirst) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange(1, [self.viewControllers count] - 1)]; + } + else if(self.popOffType == SVPopOptionTop) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange([self.viewControllers count] - 1, 1)]; + } + [delegate_ stackedView:self WillNotPopViewControllers:toPop]; } } } diff --git a/PSStackedView/PSStackedViewDelegate.h b/PSStackedView/PSStackedViewDelegate.h index 9e3df7f..cf277f9 100644 --- a/PSStackedView/PSStackedViewDelegate.h +++ b/PSStackedView/PSStackedViewDelegate.h @@ -27,10 +27,10 @@ - (void)stackedView:(PSStackedViewController *)stackedView didRemoveViewController:(UIViewController *)viewController; /// stackcontroller will pop off view controllers because of drag to right -- (void)stackedViewWillPopViewControllers:(PSStackedViewController *)stackedView; +- (void)stackedView:(PSStackedViewController*)stackedView WillPopViewControllers:(NSArray*)controllers; /// stackcontroller will no longer pop off view controllers because of drag to right -- (void)stackedViewWillNotPopViewControllers:(PSStackedViewController *)stackedView; +- (void)stackedView:(PSStackedViewController *)stackedView WillNotPopViewControllers:(NSArray*)controllers; /// stackcontroller did start dragging stack - (void)stackedViewDidStartDragging:(PSStackedViewController*)stackedView; From 8f53bc06532fbb73675656e6d6d43fc619c913df Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 09:30:47 -0700 Subject: [PATCH 08/14] Updated the example delegate implementations to use the new forms and so that it doesn't show the animation when no view controllers will be popped off (only one controller in the stack). --- .../ExampleMenuRootController.m | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Example/StackedViewKitExample/ExampleMenuRootController.m b/Example/StackedViewKitExample/ExampleMenuRootController.m index 4b5862e..38ae9d3 100644 --- a/Example/StackedViewKitExample/ExampleMenuRootController.m +++ b/Example/StackedViewKitExample/ExampleMenuRootController.m @@ -162,7 +162,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath /// PSStackedViewDelegate methods - (void)stackedViewDidStartDragging:(PSStackedViewController *)stackedView { - if([stackedView.viewControllers count] > 0) { + if([stackedView.viewControllers count] > 1) { [UIView animateWithDuration:0.2 animations:^(void) { self.popIconLeft.alpha = 1.0; self.popIconRight.alpha = 1.0; @@ -178,20 +178,24 @@ - (void)stackedViewDidStopDragging:(PSStackedViewController *)stackedView { }]; } -- (void)stackedViewWillPopViewControllers:(PSStackedViewController *)stackedView { - [UIView animateWithDuration:0.2 animations:^(void) { - self.popIconRight.alpha = 0.5; - CGAffineTransform trans = CGAffineTransformMakeTranslation(40, 10); - trans = CGAffineTransformRotate(trans, M_PI/4); - self.popIconRight.transform = trans; - }]; +-(void)stackedView:(PSStackedViewController *)stackedView WillPopViewControllers:(NSArray *)controllers { + if([controllers count] > 0) { + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconRight.alpha = 0.5; + CGAffineTransform trans = CGAffineTransformMakeTranslation(40, 10); + trans = CGAffineTransformRotate(trans, M_PI/4); + self.popIconRight.transform = trans; + }]; + } } -- (void)stackedViewWillNotPopViewControllers:(PSStackedViewController *)stackedView { - [UIView animateWithDuration:0.2 animations:^(void) { - self.popIconRight.alpha = 1.0; - self.popIconRight.transform = CGAffineTransformIdentity; - }]; +- (void)stackedView:(PSStackedViewController *)stackedView WillNotPopViewControllers:(NSArray *)controllers { + if([controllers count] > 0) { + [UIView animateWithDuration:0.2 animations:^(void) { + self.popIconRight.alpha = 1.0; + self.popIconRight.transform = CGAffineTransformIdentity; + }]; + } } @end From 0da85fd7ae9e3feef4f8470dd8df197546bc6260 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 11:19:02 -0700 Subject: [PATCH 09/14] Change the distance that needs to be dragged to the right to be a property --- PSStackedView/PSStackedViewController.h | 3 +++ PSStackedView/PSStackedViewController.m | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PSStackedView/PSStackedViewController.h b/PSStackedView/PSStackedViewController.h index 91f7603..73b6026 100644 --- a/PSStackedView/PSStackedViewController.h +++ b/PSStackedView/PSStackedViewController.h @@ -124,6 +124,9 @@ enum { /// Property to determine the type of pop off action that will be taken when entire stack is dragged to the right @property(nonatomic, assign) PSSVPopOption popOffType; +/// Property to determine the distance the stack has to be dragged to the right to trigger popOff +@property(nonatomic, assign) NSUInteger popOffDragDistance; + /// left inset thats always visible. Defaults to 60. @property(nonatomic, assign) NSUInteger leftInset; /// animate setting of the left inset that is always visible diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index f7902c1..a882ea2 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -18,7 +18,7 @@ #define kPSSVStackAnimationPopDuration kPSSVStackAnimationSpeedModifier * 0.25f #define kPSSVMaxSnapOverOffset 20 #define kPSSVAssociatedBaseViewControllerKey @"kPSSVAssociatedBaseViewController" -#define kPSSVPopOffDistance 350 +#define kPSSVDefaultPopOffDragDistance 300 // reduces alpha over overlapped view controllers. 1.f would totally black-out on complete overlay #define kAlphaReductRatio 10.f @@ -36,6 +36,9 @@ @interface PSStackedViewController() { BOOL lastDragDividedOne_; NSInteger lastVisibleIndexBeforeRotation_; BOOL enableBounces_; + BOOL enablePopOffOnDragRight_; + PSSVPopOption popOffType_; + NSUInteger popOffDragDistance_; struct { unsigned int delegateWillInsertViewController:1; unsigned int delegateDidInsertViewController:1; @@ -67,6 +70,7 @@ @implementation PSStackedViewController @synthesize enableBounces = enableBounces_; @synthesize enablePopOffOnDragRight = enablePopOffOnDragRight_; @synthesize popOffType = popOffType_; +@synthesize popOffDragDistance = popOffDragDistance_; @dynamic firstVisibleIndex; #ifdef ALLOW_SWIZZLING_NAVIGATIONCONTROLLER @@ -86,6 +90,7 @@ - (id)initWithRootViewController:(UIViewController *)rootViewController; { // set some reasonble defaults leftInset_ = 60; largeLeftInset_ = 200; + popOffDragDistance_ = kPSSVDefaultPopOffDragDistance; // add a gesture recognizer to detect dragging to the guest controllers UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanFrom:)]; @@ -807,7 +812,7 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { } if(self.enablePopOffOnDragRight) { - if(self.floatIndex == 0.0 && lastDragOffset_ > kPSSVPopOffDistance) { + if(self.floatIndex == 0.0 && lastDragOffset_ > popOffDragDistance_) { if(lastDragOption_ != SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionPopRight; if(delegateFlags_.delegateWillPopViewControllers) { From 36e0feee6280f38903637574fd7e167ea1900dc6 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 12:18:18 -0700 Subject: [PATCH 10/14] Changed the way that it tracks if the user has dragged far enough to the right so that it doesn't mess up if not starting with a floatIndex of 0.0 (can often start from floatIndex 0.5) --- PSStackedView/PSStackedViewController.m | 41 +++++++++++++++---------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index a882ea2..00485b4 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -18,7 +18,7 @@ #define kPSSVStackAnimationPopDuration kPSSVStackAnimationSpeedModifier * 0.25f #define kPSSVMaxSnapOverOffset 20 #define kPSSVAssociatedBaseViewControllerKey @"kPSSVAssociatedBaseViewController" -#define kPSSVDefaultPopOffDragDistance 300 +#define kPSSVDefaultPopOffDragDistance 150 // reduces alpha over overlapped view controllers. 1.f would totally black-out on complete overlay #define kAlphaReductRatio 10.f @@ -39,6 +39,7 @@ @interface PSStackedViewController() { BOOL enablePopOffOnDragRight_; PSSVPopOption popOffType_; NSUInteger popOffDragDistance_; + NSInteger popOffDragDistanceRemaining_; struct { unsigned int delegateWillInsertViewController:1; unsigned int delegateDidInsertViewController:1; @@ -765,6 +766,7 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { // reset last offset if gesture just started if (state == UIGestureRecognizerStateBegan) { lastDragOffset_ = 0; + popOffDragDistanceRemaining_ = popOffDragDistance_; } NSInteger offset = translatedPoint.x - lastDragOffset_; @@ -812,25 +814,30 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { } if(self.enablePopOffOnDragRight) { - if(self.floatIndex == 0.0 && lastDragOffset_ > popOffDragDistance_) { - if(lastDragOption_ != SVSnapOptionPopRight) { - lastDragOption_ = SVSnapOptionPopRight; - if(delegateFlags_.delegateWillPopViewControllers) { - NSArray* toPop; - if(self.popOffType == SVPopOptionAll) { - toPop = [self.viewControllers copy]; - } - else if(self.popOffType == SVPopOptionAllButFirst) { - toPop = [self.viewControllers subarrayWithRange:NSMakeRange(1, [self.viewControllers count] - 1)]; - } - else if(self.popOffType == SVPopOptionTop) { - toPop = [self.viewControllers subarrayWithRange:NSMakeRange([self.viewControllers count] - 1, 1)]; - } - [delegate_ stackedView:self WillPopViewControllers:toPop]; + if(self.floatIndex == 0.0) { + popOffDragDistanceRemaining_ -= offset; + } + else { + popOffDragDistanceRemaining_ = popOffDragDistance_; + } + + if(popOffDragDistanceRemaining_ <= 0 && lastDragOption_ != SVSnapOptionPopRight) { + lastDragOption_ = SVSnapOptionPopRight; + if(delegateFlags_.delegateWillPopViewControllers) { + NSArray* toPop; + if(self.popOffType == SVPopOptionAll) { + toPop = [self.viewControllers copy]; + } + else if(self.popOffType == SVPopOptionAllButFirst) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange(1, [self.viewControllers count] - 1)]; + } + else if(self.popOffType == SVPopOptionTop) { + toPop = [self.viewControllers subarrayWithRange:NSMakeRange([self.viewControllers count] - 1, 1)]; } + [delegate_ stackedView:self WillPopViewControllers:toPop]; } } - else if(lastDragOption_ == SVSnapOptionPopRight) { + else if(popOffDragDistanceRemaining_ > 0 && lastDragOption_ == SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionNearest; if(delegateFlags_.delegateWillNotPopViewControllers) { NSArray* toPop; From a7428d0aaca9caa281e468138ce24ee513f2364b Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 12:48:03 -0700 Subject: [PATCH 11/14] Change to how it calculates the drag distance to include movement for all cases where floatIndex < 0.5 instead of == 0.0 --- PSStackedView/PSStackedViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index 00485b4..6698110 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -18,7 +18,7 @@ #define kPSSVStackAnimationPopDuration kPSSVStackAnimationSpeedModifier * 0.25f #define kPSSVMaxSnapOverOffset 20 #define kPSSVAssociatedBaseViewControllerKey @"kPSSVAssociatedBaseViewController" -#define kPSSVDefaultPopOffDragDistance 150 +#define kPSSVDefaultPopOffDragDistance 200 // reduces alpha over overlapped view controllers. 1.f would totally black-out on complete overlay #define kAlphaReductRatio 10.f @@ -814,7 +814,7 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { } if(self.enablePopOffOnDragRight) { - if(self.floatIndex == 0.0) { + if(self.floatIndex < 0.5) { popOffDragDistanceRemaining_ -= offset; } else { From 5de4896cb076ea1cd8c1491bb21f7671c4963da0 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Wed, 15 Feb 2012 13:09:28 -0700 Subject: [PATCH 12/14] Change the drag distance calculations to be based upon the position of the first view controller in the stack instead of the users drag; makes it much more consistent in behaviour --- PSStackedView/PSStackedViewController.m | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index 6698110..6a7550c 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -18,7 +18,7 @@ #define kPSSVStackAnimationPopDuration kPSSVStackAnimationSpeedModifier * 0.25f #define kPSSVMaxSnapOverOffset 20 #define kPSSVAssociatedBaseViewControllerKey @"kPSSVAssociatedBaseViewController" -#define kPSSVDefaultPopOffDragDistance 200 +#define kPSSVDefaultPopOffDragDistance 150 // reduces alpha over overlapped view controllers. 1.f would totally black-out on complete overlay #define kAlphaReductRatio 10.f @@ -39,7 +39,6 @@ @interface PSStackedViewController() { BOOL enablePopOffOnDragRight_; PSSVPopOption popOffType_; NSUInteger popOffDragDistance_; - NSInteger popOffDragDistanceRemaining_; struct { unsigned int delegateWillInsertViewController:1; unsigned int delegateDidInsertViewController:1; @@ -766,7 +765,6 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { // reset last offset if gesture just started if (state == UIGestureRecognizerStateBegan) { lastDragOffset_ = 0; - popOffDragDistanceRemaining_ = popOffDragDistance_; } NSInteger offset = translatedPoint.x - lastDragOffset_; @@ -813,15 +811,13 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { lastDragOffset_ = translatedPoint.x; } - if(self.enablePopOffOnDragRight) { - if(self.floatIndex < 0.5) { - popOffDragDistanceRemaining_ -= offset; - } - else { - popOffDragDistanceRemaining_ = popOffDragDistance_; - } + if(self.enablePopOffOnDragRight && [viewControllers_ count] > 0) { + UIViewController* fvc = (UIViewController*)[viewControllers_ objectAtIndex:0]; + NSInteger currentDragDistance = (fvc.containerView.left - largeLeftInset_); + + NSLog(@"Current Drag Distance: %d", currentDragDistance); - if(popOffDragDistanceRemaining_ <= 0 && lastDragOption_ != SVSnapOptionPopRight) { + if(currentDragDistance > popOffDragDistance_ && lastDragOption_ != SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionPopRight; if(delegateFlags_.delegateWillPopViewControllers) { NSArray* toPop; @@ -837,7 +833,7 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { [delegate_ stackedView:self WillPopViewControllers:toPop]; } } - else if(popOffDragDistanceRemaining_ > 0 && lastDragOption_ == SVSnapOptionPopRight) { + else if(currentDragDistance < popOffDragDistance_ && lastDragOption_ == SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionNearest; if(delegateFlags_.delegateWillNotPopViewControllers) { NSArray* toPop; From 0ef8f675619061b449805afa124180c44e12ddb4 Mon Sep 17 00:00:00 2001 From: Marcel Ball Date: Thu, 23 Feb 2012 15:19:05 -0700 Subject: [PATCH 13/14] Changed drag distances to be signed so comparison works correctly --- PSStackedView/PSStackedViewController.h | 2 +- PSStackedView/PSStackedViewController.m | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/PSStackedView/PSStackedViewController.h b/PSStackedView/PSStackedViewController.h index 73b6026..3ea067c 100644 --- a/PSStackedView/PSStackedViewController.h +++ b/PSStackedView/PSStackedViewController.h @@ -125,7 +125,7 @@ enum { @property(nonatomic, assign) PSSVPopOption popOffType; /// Property to determine the distance the stack has to be dragged to the right to trigger popOff -@property(nonatomic, assign) NSUInteger popOffDragDistance; +@property(nonatomic, assign) NSInteger popOffDragDistance; /// left inset thats always visible. Defaults to 60. @property(nonatomic, assign) NSUInteger leftInset; diff --git a/PSStackedView/PSStackedViewController.m b/PSStackedView/PSStackedViewController.m index 6a7550c..cbafcc6 100644 --- a/PSStackedView/PSStackedViewController.m +++ b/PSStackedView/PSStackedViewController.m @@ -38,7 +38,7 @@ @interface PSStackedViewController() { BOOL enableBounces_; BOOL enablePopOffOnDragRight_; PSSVPopOption popOffType_; - NSUInteger popOffDragDistance_; + NSInteger popOffDragDistance_; struct { unsigned int delegateWillInsertViewController:1; unsigned int delegateDidInsertViewController:1; @@ -815,8 +815,6 @@ - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer { UIViewController* fvc = (UIViewController*)[viewControllers_ objectAtIndex:0]; NSInteger currentDragDistance = (fvc.containerView.left - largeLeftInset_); - NSLog(@"Current Drag Distance: %d", currentDragDistance); - if(currentDragDistance > popOffDragDistance_ && lastDragOption_ != SVSnapOptionPopRight) { lastDragOption_ = SVSnapOptionPopRight; if(delegateFlags_.delegateWillPopViewControllers) { From 5ca33db499068f3f813889f86c2cfe65e7c34d6a Mon Sep 17 00:00:00 2001 From: fabiosoft Date: Tue, 5 Feb 2013 14:38:57 +0100 Subject: [PATCH 14/14] code credits --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 32594ef..76874a0 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ window.rootViewController = self.stackController; PSStackedViewRootController's rootViewController is in the background and its left part is always visible. Adjust the size with leftInset and largeLeftInset. +PS: Added "Remove top view controller if user slides stack to the right" + +Code by: [mball-crrc](https://github.com/mball-crrc/PSStackedView/tree/feature/pop_off_on_drag_right) + +Pull merge by: [fabiosoft](https://github.com/fabiosoft) - [website](http://www.fabiosoft.com) + ## Roadmap - Add (conditional) support for the new child view controller system in iOS5 - Appledoc