折旧的NSNibLoading方法(loadNibFile :, loadNibNamed :,等)的替换? [英] Replacements for the depreciated NSNibLoading methods (loadNibFile:, loadNibNamed:, etc.)?
问题描述
我发现NSBundle中的NSNibLoading方法:
+ [NSBundle loadNibFile:externalNameTable:withZone:]
+ [NSBundle loadNibNamed:owner:]
- [NSBundle loadNibFile:externalNameTable:withZone:]
都已在10.8中被标记为弃用 - 在10.8和更高版本中加载nib的正确方法是什么?
我试图在我的应用程序,我必须创建 NSWindowController
与 initWithWindowNibName
为自定义工作表吗?
<
NSBundle
类方法 loadNibNamed:owner:
在OS X v10.8中已弃用, loadNibNamed:owner:topLevelObjects:
为不和注释在文档中状态为什么:
与传统方法不同,对象遵循标准的可可内存管理规则;必须通过使用IBOutlet或保存对数组的引用来保持对它们的强引用,以防止nib内容被重新分配。
I have found that the NSNibLoading methods in NSBundle:
+[NSBundle loadNibFile:externalNameTable:withZone:]
+[NSBundle loadNibNamed:owner:]
-[NSBundle loadNibFile:externalNameTable:withZone:]
have all been marked deprecated in 10.8 - what is the proper way to load the nibs in 10.8 and later?
I'm trying to create a custom sheet in my app, do I have to create NSWindowController
with initWithWindowNibName
for the custom sheet?
The NSBundle
class method loadNibNamed:owner:
is deprecated in OS X v10.8,
loadNibNamed:owner:topLevelObjects:
is not and the comments in the documentation state why:
Unlike legacy methods, the objects adhere to the standard cocoa memory management rules; it is necessary to keep a strong reference to them by using IBOutlets or holding a reference to the array to prevent the nib contents from being deallocated.
这篇关于折旧的NSNibLoading方法(loadNibFile :, loadNibNamed :,等)的替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!