Anyone know how to draw an NSImage OVER an NSVIEW

I have an NSView with some controls … I need to draw a template image OVER
The template is “clear” where thing need to show thru, and that is fine

the problem is the image is drawn BEFORE the controls, and there are edges where I actually want the template to obsure bits of the controls underneath

You got choices here.

Either append a CALayer with the image into the containing NSView, or simply use a second NSView atop the containing NSView. I personally use the later then the image isn’t clipped to the containing NSView’s frame.

The drawRect event is for the background only.

Thanks… I had just come to a simlar conclusion… am going to test it now…


The GRAY area is the actual main NSVIEW
on top of that is a smaller drawing area (the purple with the white line)… its corners are purposely obscured by the rounded black corners
then finally the device template layer, another NSView with transparent areas to allow the draw area to show thru. Note the two horizontal gray lines are on the device layer and represent the SAFEAREA boundary. The “Device Name” label is also part of the device template layer