如何旋转nscell

时间:2010-09-02 15:48:57

标签: cocoa rotation nsaffinetransform

我正在创建NSLevelIndicatorCell的子类,我想垂直绘制它。这不起作用,我做错了什么?

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform rotateByDegrees:90];
[transform concat];
[super drawWithFrame:cellFrame inView:controlView];
[[NSGraphicsContext currentContext] restoreGraphicsState];}

1 个答案:

答案 0 :(得分:0)

[self setBoundsRotation:90];

[self setNeedsDisplay];

现在,我只需要弄清楚如何让可调整大小的边从水平变为垂直......