Skip to content

Instantly share code, notes, and snippets.

@anthonyherron
Created December 23, 2011 16:36
Show Gist options
  • Save anthonyherron/1514686 to your computer and use it in GitHub Desktop.
Save anthonyherron/1514686 to your computer and use it in GitHub Desktop.
For Dan
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect rectForBezierPath = CGRectMake(100.0, 100.0, 100.0, 100.0);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rectForBezierPath byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(8.0, 8.0)];
[[UIColor whiteColor] setFill];
[path fill];
// add shadow and stroke to clipped path
CGContextSaveGState(context);
[path addClip];
CGContextSetShadowWithColor(context, CGSizeMake(0.0, 0.0), 12.0, [[UIColor redColor] CGColor]);
[[UIColor lightGrayColor] setStroke];
[path setLineWidth:2.0];
[path stroke];
CGContextRestoreGState(context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment