如何使用CGAffineTransformMakeRotation? [英] How to use CGAffineTransformMakeRotation?
本文介绍了如何使用CGAffineTransformMakeRotation?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
>
绘制文本使用Quartz 2D。 菜单方向错误。我想菜单仍然可读,与X轴45度。下面是我的代码:
I want to draw text use Quartz 2D. The "menu" direction is wrong. I want "Menu" still readable and have 45 degree with X-axis. Below is my code:
CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetRGBFillColor(context, 0, 0, 0, 1); // 6
CGContextSetRGBStrokeColor(context, 0, 0, 0, 1);
CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0));
CGContextSetTextMatrix(context, CGAffineTransformMakeRotation(45));
CGContextShowTextAtPoint(context,10, 10, "Menu", 4);
推荐答案
#define DEGREES_TO_RADIANS(x) (M_PI * (x) / 180.0)
...
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(45));
这篇关于如何使用CGAffineTransformMakeRotation?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文