2010-04-20 57 views
2

目前我在定制的NSCell像这样绘制NSImage中下绘制阴影:NSImage中

- (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView *)theControlView { 
    // roundedCornerImage creates a new NSImage with rounded corners, rather than clipping. 
    [[anIcon roundedCornerImage:5] drawInRect:anIconBox fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; 
} 

很简单,我不知道如何绘制图像它的下面。在iPhone上,我可以通过以下方式来实现:CGContextSetShadow (currentContext, CGSizeMake(1, -1), 2);就在绘制UIImage之前,但我不熟悉如何在Mac上执行此操作。

任何指针都会很棒。

回答

3

看看NSShadow类。 Mac上也存在CGContextSetShadow,但将其放在上下文本身上稍微难一些。

+0

完美,作品一种享受! – 2010-04-20 22:46:23