gpt4 book ai didi

objective-c - NSWindow 内存选项

转载 作者:行者123 更新时间:2023-11-28 07:07:50 24 4
gpt4 key购买 nike

在我的项目中使用 NSWindow 时,我通常会指定 realeaseWhenClosed 选项,并在需要时重新加载它。我用谷歌搜索了 NSWindow 内存选项,但找不到任何具体信息:

有人可以向我解释一下 NSWindow 内存选项的区别,即 deferredone shotbuffered , 保留, 不保留

最佳答案

您应该始终按照此处的说明使用缓冲 NSBackingStoreType—Buffered Window Drawing其他两个选项(保留和非保留)你也不应按照此处所述使用。

Buffered The window renders all drawing into a display buffer and then flushes it to the screen.

You should use this mode. It supports hardware acceleration, Quartz drawing, and takes advantage of the GPU when possible. It also supports alpha channel drawing, opacity controls, using the compositor.

适用于 OS X v10.0 及更高版本。

The defer argument to initWithContentRect:styleMask:backing:defer: specifies whether the NSWindow creates its window device immediately or only when it's moved on screen. Deferring creation of the window device can offer some performance gain for windows that aren't displayed immediately because it reduces the amount of work that needs to be performed up front. Deferring creation of the window device is particularly useful when creation of the NSWindow itself can't be deferred or when an NSWindow is needed for purposes other than displaying content. Submenus with key equivalents, for example, must exist for the key equivalents to work, but may never actually be displayed.

Memory can also be saved by destroying the window device when the window is removed from the screen. The setOneShot: method controls this behavior. One-shot window devices exist only when their NSWindows are on screen. This means that backing stores are also released when an application is hidden, or when a window is miniaturized.

关于objective-c - NSWindow 内存选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29793815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com