Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EvgenyMorozov/c790ec8cd78995daf831 to your computer and use it in GitHub Desktop.
Save EvgenyMorozov/c790ec8cd78995daf831 to your computer and use it in GitHub Desktop.
Override layoutSubviews to achieve material design appearance
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat radius = 2.0f;
self.layer.cornerRadius = radius;
self.layer.masksToBounds = NO;
self.layer.shadowColor = [UIColor blackColor].CGColor;
self.layer.shadowOffset = CGSizeMake(0, 3);
self.layer.shadowOpacity = 0.5;
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:radius];
self.layer.shadowPath = path.CGPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment