4

我有一个无边框的 NSWindow,我将它作为子窗口添加到应用程序的主窗口。在特定模式下,子窗口可能部分位于父窗口的框架之外,然后它会向前缩放以完全封闭。

如果主窗口不是全屏的,那么在主窗口之外绘制子窗口看起来很奇怪。可以剪辑吗?

4

1 回答 1

1

No, I don’t think so. On OS X, windows (and thereby NSWindows) are composited by the window server, and have their own buffers. They’re essentially OpenGL quads and the drawing is done into a texture (that is a simplification, but it’s basically how it works).

You don’t explain in your question why you’re using a child window (as opposed to, for instance, a layer-backed view, or even just a plain NSView); often, you can avoid using child windows at all, which would seem to be the most straightforward solution to your problem in this instance.

(Note, if you’re coming from a Windows background, that Cocoa expects you to use views rather than windows for most purposes; in a typical application you only need to use windows at the top level of your interface hierarchy.)

于 2014-02-03T09:25:16.217 回答