Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added property to enable/disable shadows.

  • Loading branch information...
commit 600c836ec473c385df9b49fbf99c4eb41c16e237 1 parent 76c6c7f
Christopher Constable authored
3  PSStackedView/PSStackedViewController.h
View
@@ -111,6 +111,9 @@ enum {
/// Property to disable bounces
@property(nonatomic, assign) BOOL enableBounces;
+/// Property to disable shadows
+@property(nonatomic, assign) BOOL enableShadows;
+
/// left inset thats always visible. Defaults to 60.
@property(nonatomic, assign) NSUInteger leftInset;
/// animate setting of the left inset that is always visible
60 PSStackedView/PSStackedViewController.m
View
@@ -61,6 +61,7 @@ @implementation PSStackedViewController
@synthesize delegate = delegate_;
@synthesize reduceAnimations = reduceAnimations_;
@synthesize enableBounces = enableBounces_;
+@synthesize enableShadows = enableShadows_;
@dynamic firstVisibleIndex;
#ifdef ALLOW_SWIZZLING_NAVIGATIONCONTROLLER
@@ -91,6 +92,7 @@ - (id)initWithRootViewController:(UIViewController *)rootViewController; {
[self.view addGestureRecognizer:panRecognizer];
self.panRecognizer = panRecognizer;
enableBounces_ = YES;
+ enableShadows_ = YES;
#ifdef ALLOW_SWIZZLING_NAVIGATIONCONTROLLER
@@ -559,35 +561,37 @@ - (CGFloat)overlapRatio {
// updates view containers
- (void)updateViewControllerMasksAndShadow {
- // only one!
- if ([self.viewControllers count] == 1) {
- // [[self firstViewController].containerView addMaskToCorners:UIRectCornerAllCorners];
- self.firstViewController.containerView.shadow = PSSVSideLeft | PSSVSideRight;
- }else {
- // rounded corners on first and last controller
- [self.viewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- UIViewController *vc = (UIViewController *)obj;
- if (idx == 0) {
- //[vc.containerView addMaskToCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft];
- }else if(idx == [self.viewControllers count]-1) {
- // [vc.containerView addMaskToCorners:UIRectCornerBottomRight | UIRectCornerTopRight];
- vc.containerView.shadow = PSSVSideLeft | PSSVSideRight;
- }else {
- // [vc.containerView removeMask];
- vc.containerView.shadow = PSSVSideLeft | PSSVSideRight;
+ if (enableShadows_ == YES) {
+ // only one!
+ if ([self.viewControllers count] == 1) {
+ // [[self firstViewController].containerView addMaskToCorners:UIRectCornerAllCorners];
+ self.firstViewController.containerView.shadow = PSSVSideLeft | PSSVSideRight;
+ }else {
+ // rounded corners on first and last controller
+ [self.viewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+ UIViewController *vc = (UIViewController *)obj;
+ if (idx == 0) {
+ //[vc.containerView addMaskToCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft];
+ }else if(idx == [self.viewControllers count]-1) {
+ // [vc.containerView addMaskToCorners:UIRectCornerBottomRight | UIRectCornerTopRight];
+ vc.containerView.shadow = PSSVSideLeft | PSSVSideRight;
+ }else {
+ // [vc.containerView removeMask];
+ vc.containerView.shadow = PSSVSideLeft | PSSVSideRight;
+ }
+ }];
+ }
+
+ // update alpha mask
+ CGFloat overlapRatio = [self overlapRatio];
+ UIViewController *overlappedVC = [self overlappedViewController];
+ overlappedVC.containerView.darkRatio = MIN(overlapRatio, 1.f)/kAlphaReductRatio;
+
+ // reset alpha ratio everywhere else
+ for (UIViewController *vc in self.viewControllers) {
+ if (vc != overlappedVC) {
+ vc.containerView.darkRatio = 0.0f;
}
- }];
- }
-
- // update alpha mask
- CGFloat overlapRatio = [self overlapRatio];
- UIViewController *overlappedVC = [self overlappedViewController];
- overlappedVC.containerView.darkRatio = MIN(overlapRatio, 1.f)/kAlphaReductRatio;
-
- // reset alpha ratio everywhere else
- for (UIViewController *vc in self.viewControllers) {
- if (vc != overlappedVC) {
- vc.containerView.darkRatio = 0.0f;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.