Skip to content

Instantly share code, notes, and snippets.

@mundstein
Created May 10, 2012 12:47
Show Gist options
  • Save mundstein/2652825 to your computer and use it in GitHub Desktop.
Save mundstein/2652825 to your computer and use it in GitHub Desktop.
Create a fancy shadow^
/*
* Create a fancy shadow around the frontView.
*
* Note: UIBezierPath needed because shadows are evil. If you don't use the path, you might not
* not notice a difference at first, but the keen eye will (even on an iPhone 4S) observe that
* the interface rotation _WILL_ lag slightly and feel less fluid than with the path.
*/
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.frontView.bounds];
self.frontView.layer.masksToBounds = NO;
self.frontView.layer.shadowColor = [UIColor blackColor].CGColor;
self.frontView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
self.frontView.layer.shadowOpacity = 1.0f;
self.frontView.layer.shadowRadius = 2.5f;
self.frontView.layer.shadowPath = shadowPath.CGPath;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment