テキストの描画に次のコード スニペットを使用しています。
CGFloat DegreesToRadiansText(CGFloat degrees) {return degrees * M_PI / 180;};
CGContextSelectFont (context, "Arial Rounded MT Bold", 18, kCGEncodingMacRoman);
CGContextSetCharacterSpacing (context, 0);
CGContextSetTextDrawingMode (context, kCGTextFill);
CGContextSetGrayFillColor(context, 0.0, 1.0);
CGAffineTransform myTextTransform = CGAffineTransformRotate(CGAffineTransformScale(CGAffineTransformIdentity, 1.f, -1.f ),(DegreesToRadiansText (-90));
CGContextSetTextMatrix (context, myTextTransform);
CGContextShowTextAtPoint (context, 552, 445, "iPhone\nUser", 11);
単一行のテキストを描画すると、上記のコードは正常に機能します。
しかし、複数行のテキスト (つまり、上記のコードに示すように '\n' 文字を含むテキスト) を追加すると、1 行のテキストとして表示されます。
今、私は下の図に示すように出力を得ています:
しかし、下の図に示すような出力が必要です。
関数CGContextShowTextAtPointを使用して複数行の文字列を描画できる方法はありますか、それとも代替手段はありますか?
前もって感謝します。