Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa 在NSImage下绘制阴影_Cocoa_Shadow_Nsimage_Nscell - Fatal编程技术网

Cocoa 在NSImage下绘制阴影

Cocoa 在NSImage下绘制阴影,cocoa,shadow,nsimage,nscell,Cocoa,Shadow,Nsimage,Nscell,目前,我正在自定义NSCell中绘制NSImage,如下所示: - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView *)theControlView { // roundedCornerImage creates a new NSImage with rounded corners, rather than clipping. [[anIcon roundedCornerImage:5] drawIn

目前,我正在自定义NSCell中绘制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上进行

任何指点都会很好。

看看这门课
CGContextSetShadow
也存在于Mac上,但要掌握上下文本身就稍微困难一些