Created
May 29, 2015 15:05
-
-
Save EvgenyMorozov/c790ec8cd78995daf831 to your computer and use it in GitHub Desktop.
Override layoutSubviews to achieve material design appearance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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