views:

172

answers:

1

Currently I'm drawing an NSImage in a custom NSCell like so:

- (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];
}

Very simply I'm wondering how to draw an image underneath it. On the iPhone, I would do this by using: CGContextSetShadow (currentContext, CGSizeMake(1, -1), 2); just before drawing the UIImage, but I'm unfamiliar with how to do it on the Mac.

Any pointers would be great.

+2  A: 

Look into the NSShadow class. CGContextSetShadow also exists on the Mac, but it's slightly more difficult to get your hands on the context itself.

John Calsbeek
Perfect, works a treat!
Tom Irving