Skip to content

Commit

Permalink
Add top and bottom shadow layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
André Schneider committed Jul 15, 2014
1 parent 48a3210 commit 4587035
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Popping/FoldView.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ - (BOOL)isLocation:(CGPoint)location inView:(UIView *)view;
@property(nonatomic) UIImage *image;
@property(nonatomic) UIImageView *topView;
@property(nonatomic) UIImageView *backView;
@property(nonatomic) CAGradientLayer *bottomShadowLayer;
@property(nonatomic) CAGradientLayer *topShadowLayer;
@end

@implementation FoldView
Expand Down Expand Up @@ -69,7 +71,12 @@ - (void)addTopView
self.backView.image = [image blurredImage];;
self.backView.alpha = 0.0;

self.topShadowLayer = [CAGradientLayer layer];
self.topShadowLayer.frame = self.topView.bounds;
self.topShadowLayer.colors = @[(id)[UIColor clearColor].CGColor, (id)[UIColor blackColor].CGColor];

[self.topView addSubview:self.backView];
[self.topView.layer addSublayer:self.topShadowLayer];
[self addSubview:self.topView];
}

Expand All @@ -84,6 +91,12 @@ - (void)addBottomView
bottomView.image = image;
bottomView.contentMode = UIViewContentModeScaleAspectFill;
bottomView.layer.mask = [self maskForSection:LayerSectionBottom withRect:bottomView.bounds];

self.bottomShadowLayer = [CAGradientLayer layer];
self.bottomShadowLayer.frame = bottomView.bounds;
self.bottomShadowLayer.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor clearColor].CGColor];

[bottomView.layer addSublayer:self.bottomShadowLayer];
[self addSubview:bottomView];
}

Expand Down

0 comments on commit 4587035

Please sign in to comment.