Skip to content

Instantly share code, notes, and snippets.

@tudormunteanu
Created October 25, 2011 10:11
Show Gist options
  • Save tudormunteanu/1312148 to your computer and use it in GitHub Desktop.
Save tudormunteanu/1312148 to your computer and use it in GitHub Desktop.
UIView with rounded corners
UIView *container = [[UIView alloc] initWithFrame:rect];
// radius
container.layer.cornerRadius = 5;
// shadow path
container.layer.cornerRadius = 20;
container.layer.shadowColor = [[UIColor blackColor] CGColor];;
container.layer.masksToBounds = NO;
container.layer.shadowOffset = CGSizeMake(0, -10);
container.layer.shadowOpacity = 0.4;
CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:CGRectInset(container.layer.bounds, 0, 0)].CGPath;
container.layer.shadowPath = shadowPath;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment