次のようにしてコアグラフィックにテキストを描画しています
- (void)drawRect:(CGRect)rect {
CGContextTranslateCTM(context, 20, 150);
CGContextScaleCTM(context, 1, 1);
// Draw the text using the MyDrawText function
myDrawText(context, viewBounds);
}
void myDrawText (CGContextRef myContext, CGRect contextRect)
{
CGFloat w, h;
w = contextRect.size.width;
h = contextRect.size.height;
CGAffineTransform myTextTransform;
CGContextSelectFont (myContext,
"Helvetica-Bold",
h/12,
kCGEncodingMacRoman);
CGContextSetCharacterSpacing (myContext, .5);
CGContextSetTextDrawingMode (myContext, kCGTextFill);
CGContextSetRGBFillColor (myContext, 1, 1, 1, 1);
myTextTransform = CGAffineTransformMakeRotation (0);
CGContextSetTextMatrix (myContext, myTextTransform);
CGContextShowTextAtPoint (myContext, 115, 0, "Successful", 10);
}
それを実行した後、私はテキストが下のように逆さまになっているのを取得しています
描画後にテキストが上下逆になる理由
この問題について私にアドバイスしてください。