Created
December 4, 2014 07:55
-
-
Save tomisacat/ac690939d9c02ce1dbb0 to your computer and use it in GitHub Desktop.
clear a circle/ellipse area like CGContextClearRect to clear a rect area
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)drawRect:(CGRect)rect | |
{ | |
CGContextRef con = UIGraphicsGetCurrentContext(); | |
CGContextSetFillColorWithColor(con, [UIColor grayColor].CGColor); | |
CGContextFillRect(con, rect); | |
CGContextAddEllipseInRect(con, self.circle); // self.circle is a property of CGRect | |
CGContextClip(con); | |
CGContextClearRect(con, self.circle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment