Core Graphics, adding text and other Core graphics
Hi, my basic question is if we can add core graphics ontop of each other like this:
endAngle = endAngle + (data.value * valueOfDegree);
CGContextSetFillColor(graphicContext, CGColorGetComponents(data.color));
CGContextMoveToPoint(graphicContext, x,y);
CGContextAddArc(graphicContext, x, y, radius, convertToRadians(startAngle), convertToRadians(endAngle), 0);
CGContextClosePath(graphicContext);
CGContextFillPath(graphicContext);
double midAngle = startAngle + (data.value * valueOfDegree);
float xTempPoint = x + radius*(asin(convertToRadians(midAngle - startAngle)));
float yTempPoint = y + radius*-(acos(convertToRadians(midAngle - startAngle)));
CGFloat xMiddle = (x + xTempPoint)/2;
CGFloat yMiddle = (y + yTempPoint)/2;
char* temp = "test";
//(char*)[data.name cStringUsingEncoding:NSMacOSRomanStringEncoding];
CGContextSelectFont(graphicContext, "Helvetica", 12, NSMacOSRomanStringEncoding);
CGContextSetTextDrawingMode(graphicContext, kCGTextFill);
CGContextSetFillColor(graphicContext, CGColorGetComponents([[UIColor whiteColor] CGColor]));
CGAffineTransform xform = CGAffineTransformMake(
1.0, 0.0,
0.0, -1.0,
0.0, 0.0);
CGContextSetTextMatrix(graphicContext, xform);
CGContextShowTextAtPoint(graphicContext, xMiddle, yMiddle, temp, strlen(temp));
startAngle = endAngle;
if so, why does this not work?
|