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);
何か案は?