【发布时间】:2013-03-21 22:41:13
【问题描述】:
我可以使用drawAtPoint 方法在CustomView 中绘制NSString:
NSString *text = @"text";
NSSize textSize = [text sizeWithAttributes:xlabelSet]; //receive the text size
NSPoint p = NSMakePoint(length - textSize.width/2 , wcszero_y - 20); //define text position considering the text center
[text drawAtPoint:p withAttributes:xlabelSet]; //draw text at position
如何在同一位置将文本旋转 90 度?到目前为止,我发现并没有真正在定义的位置旋转文本。
【问题讨论】:
-
食梦者您好,感谢您的回答。我查了一下,我不相信,因为 Mac 开发人员库声明了这一点:
If you want only to rotate an object to be drawn, it is not necessary to construct an affine transform to do so. The most direct way to rotate your drawing is by calling the function CGContextRotateCTM.。所以,Aleph7 是在正确的轨道上,但我需要找出以某种方式使其适应 osx。 -
你的帮助根本没有帮助。谢谢。
标签: objective-c nsstring rotatetransform