是否已替换不推荐使用的NSNibLoading方法(loadNibFile:,loadNibNamed:等)? [英] Replacements for the deprecated NSNibLoading methods (loadNibFile:, loadNibNamed:, etc.)?
问题描述
我发现NSBundle中的NSNibLoading方法:
I have found that the NSNibLoading methods in NSBundle:
+[NSBundle loadNibFile:externalNameTable:withZone:]
+[NSBundle loadNibNamed:owner:]
-[NSBundle loadNibFile:externalNameTable:withZone:]
在10.8中所有标记都已弃用-在10.8及更高版本中加载笔尖的正确方法是什么?
have all been marked deprecated in 10.8 - what is the proper way to load the nibs in 10.8 and later?
我正在尝试在我的应用程序中创建自定义工作表,我是否必须使用initWithWindowNibName
为自定义工作表创建NSWindowController
?
I'm trying to create a custom sheet in my app, do I have to create NSWindowController
with initWithWindowNibName
for the custom sheet?
推荐答案
在OS X v10.8中不推荐使用NSBundle
类方法loadNibNamed:owner:
,
loadNibNamed:owner:topLevelObjects:
是不是,注释是
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:
与传统方法不同,这些对象遵守标准可可内存管理规则;有必要通过使用IBOutlets或对数组进行引用来保持对它们的强烈引用,以防止笔尖内容被释放.
这篇关于是否已替换不推荐使用的NSNibLoading方法(loadNibFile:,loadNibNamed:等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!