Created
January 22, 2013 10:54
-
-
Save jagregory/4593780 to your computer and use it in GitHub Desktop.
Revisions
-
jagregory created this gist
Jan 22, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ @interface UIView(Corners) - (void)cornerRadius:(float)radius forCorners:(UIRectCorner)corners; @end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #import <QuartzCore/QuartzCore.h> #import "UIView+Corners.h" @implementation UIView(Corners) -(void)cornerRadius:(float)radius forCorners:(UIRectCorner)corners{ CAShapeLayer* mask = [CAShapeLayer layer]; mask.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)].CGPath; self.layer.mask = mask; } @end