Created
April 1, 2014 03:43
-
-
Save fbparis/9907321 to your computer and use it in GitHub Desktop.
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
UIBezierPath *path =[UIBezierPath bezierPath]; | |
CGPoint center = CGPointMake(rect.size.width / 2.0, rect.size.height / 2.0); | |
CGFloat radius = sqrt(pow(center.x, 2) + pow(center.y, 2)); | |
CGFloat angle = M_PI / self.count; | |
[self.color set]; | |
[path moveToPoint:center]; | |
for (NSUInteger i = 0; i < self.count; i++) { | |
[path addArcWithCenter:center radius:radius startAngle:2*i*angle endAngle:(2*i+1)*angle clockwise:YES]; | |
[path addLineToPoint:center]; | |
[path closePath]; | |
[path fill]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment