0
我必須旋轉圈內的文本,但我無法在弧畫中獲取它。我成功地使用CGAffineTranform進行旋轉,但文本始終不在徑向中心。注意:文本位於弧線內。使用IOS中的CG旋轉後的文本中心
float l_angleText=lStartAngle+((lStopAngle-lStartAngle)/2);
CGContextSelectFont(p_contex, "Helvetica", 12.5, kCGEncodingMacRoman);
CGAffineTransform myTransform=CGAffineTransformRotate(CGAffineTransformMakeScale(1,-1),-l_angleText);
CGContextSetTextMatrix(p_contex, myTransform);
CGContextSetTextDrawingMode(p_contex, kCGTextFill);
CGContextSetRGBFillColor(p_contex, 1.0, 1.0, 1.0, 1.0); //White
// get x/y for an the angle. The point in which I start drawing the text.
CGPoint lPoints = angleRToPoint(-l_angleText,[self getRadioPoint:l_angleText]);
//Move the point according the coords.
const double l_pointX = mReference.x+lPoints.x;
const double l_pointY = mReference.y-lPoints.y;
NSString* lText= [self getText];
CGContextShowTextAtPoint(p_contex, l_pointX, l_pointY, [lText UTF8String] , strlen([lText UTF8String]));