0
我使用CGContextShowText
來顯示文本,但使用CGAffineTransformation
旋轉時,旋轉軸位於左側,而不是位於繪製文本的中心,我使用的代碼是:如何更改文本旋轉軸
CGContextSaveGState(context);
CGContextSelectFont(context, "Helvetica", 20, kCGEncodingMacRoman);
CGContextSetCharacterSpacing (context, 1);
CGContextSetRGBFillColor (context, 0, 0, 0, 1);
CGAffineTransform xform = CGAffineTransformMake(
sin(DegreesToRadians(angle)), cos(DegreesToRadians(angle)),
cos(DegreesToRadians(angle)), -sin(DegreesToRadians(angle)),
0, 0);
CGContextSetTextDrawingMode (context, kCGTextFill);
CGPoint degreeDisplayPoint = CGPointMake(100,100);
CGContextShowTextAtPoint(context, degreeDisplayPoint.x, degreeDisplayPoint.y, [angleStringWithDegree cStringUsingEncoding:NSMacOSRomanStringEncoding], [angleStringWithDegree length]);
CGContextRestoreGState(context);
任何想法?