Search code examples
cocoacore-animationcalayernswindow

Is it possible to display a NSWindow on a CALayer?


I'm provided with a CALayer* and would like to know if it's possible to dynamically create a NSWindow and show it on the layer?

Thanks in advance!


Solution

  • I'm provided with a CALayer* and would like to know if it's possible to dynamically create a NSWindow …

    Yes.

    … and show it on the layer?

    Nope.

    You can make a layer that knows about the window or its content view and, when told to draw, tells the window's content view to draw, or you could take a screenshot of the window and set it as the layer's contents. But you can't put a window into a layer.