Fra*_*itt 4 macos cocoa nsstring
是否有一组我可以指定的字符串属性,当我调用时会以一定角度绘制文本:
[label drawAtPoint:textStart withAttributes:attributes];
Run Code Online (Sandbox Code Playgroud)
Mar*_*eau 11
这是一个使用变换来旋转绘图上下文的示例.基本上它就像设置颜色或阴影一样,只需确保使用-concat而不是-set.
CGFloat rotateDeg = 4.0f;
NSAffineTransform *rotate = [[NSAffineTransform alloc] init];
[rotate rotateByDegrees:rotateDeg];
[rotate concat];
// Lock focus if needed and draw strings, images here.
[rotate release];
Run Code Online (Sandbox Code Playgroud)
NSString本身没有旋转,但您可以旋转上下文.就坐标空间而言,字符串将始终"水平"绘制,但对应的实际方向取决于上下文.只需使用NSAffineTransform根据需要旋转它.
| 归档时间: |
|
| 查看次数: |
5747 次 |
| 最近记录: |