I'm trying to draw a PieChart using UIBezierPath, and I'm pretty close to that, however I have a problem, as you can see in the screenshot attached
Here is the code I'm using:
-(void)drawRect:(CGRect)rect { CGRect bounds = self.bounds; CGPoint center = CGPointMake((bounds.size.width/2.0), (bounds.size.height/2.0)); NSManagedObject *gameObject = [SCGameManager sharedInstance].gameObject; int playerNumber = 0; int totalOfPlayers = [(NSSet*)[gameObject valueForKey:@"playerColors"] count]; float anglePerPlayer = M_PI*2 / totalOfPlayers; for (NSManagedObject *aPlayerColor in [gameObject valueForKey:@"playerColors"]){
Apparently, I just need to move my path to the center of the circle and then close it, but when I add the following line of code:
[path addLineToPoint:self.center]; [path closePath];
He is drawing something strange: 
Do you have any idea what is going on with my code? I'm not a Bezier expert at all, so any help is appreciated!
Thanks!
source share